SMB2 SuperJump (Updated)

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

SMB2 SuperJump (Updated)

Postby Ditchencat » Thu Jan 05, 2017 12:46 pm

Finally! It is complete. A working SuperJump for use in your levels or episode!
Works just like the one in Super Mario Bros 2. Press and hold the DOWN key to charge up and Jump super high! Not really high.. Just enough though.

[center]Download:Here![/center]

Screenshot: (Because I like them and I didn't want to take a video of me fumbling around with my own Superjump. ;-;)
Spoiler: show
Image
Red: Normal Standing Jump - 4 Blocks
Orange: Running Jump - 5 Blocks
Purple: Super Jump - 6 Blocks!
Works on:
- Flat ground
- Slopes
- Npcs
- Linoleum
- Tile
- Wood
Wait... Wrong description.

Can't work:
- In mid-air
- In water or quicksand

One more thing to note is that this jump won't work if you're playing as Toad AND if you have a Leaf or a Tanooki suit.
( Giving a double jump AND a Super Jump to Toad? Now that can be a bit ridiculous. You have a leaf, just fly. )

Enjoy and please let me know if there is a problem or something that I've overlooked.

Original Post: Updated post on 1/28/2017 10:48 AM
Spoiler: show
Is there a way I can implement the SuperJump from Super Mario Bros 2, into my episode using LunaLua?
I plan on using this with the Toad character and increasing his jump height by two extra blocks when used.
I have very little knowledge of Lunalua and I have no idea where to start with this one. Heh. >.>

Edit: I have made my own code with the help of some people here and I am now trying to get other stuff straight.

I have yet to figure out a few things.

- How to cancel out the normal Jump sound and replace it with a different one I have.
(Otherwise they both play at the same time. >.>)
- How to make a trail of particles when a Super Jump is preformed.
(When I try to use particles.api, the trail clears itself abruptly when I land)
- And how to make the jump work while standing on block-like NPCs.
(Such as Shy-guys, Bill-Blasters, Ice Blocks, and so on...)
Thanks to the people who helped me. :)
Last edited by Ditchencat on Sat Jan 28, 2017 11:48 am, edited 5 times in total.

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: SMB2 SuperJump

Postby PixelPest » Thu Jan 05, 2017 12:49 pm

http://wohlsoft.ru/pgewiki/SMBX_Fields

Defines.jumpheight and Defines.jumpheight_bounce

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Thu Jan 05, 2017 4:42 pm

PixelPest wrote:http://wohlsoft.ru/pgewiki/SMBX_Fields
Defines.jumpheight and Defines.jumpheight_bounce
While these look nice and all... I still have no clue what to do with them.
Sorry, but i'm not familiar with the syntax of this language.

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: SMB2 SuperJump

Postby Hoeloe » Fri Jan 06, 2017 2:46 am

Ditchencat wrote:
PixelPest wrote:http://wohlsoft.ru/pgewiki/SMBX_Fields
Defines.jumpheight and Defines.jumpheight_bounce
While these look nice and all... I still have no clue what to do with them.
Sorry, but i'm not familiar with the syntax of this language.
There are some helpful tutorials on the wiki, so I suggest you have a look there. They're a tiny bit out of date now, but they should still help.

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Sat Jan 07, 2017 7:16 am

Hoeloe wrote:
Ditchencat wrote:
PixelPest wrote:http://wohlsoft.ru/pgewiki/SMBX_Fields
Defines.jumpheight and Defines.jumpheight_bounce
While these look nice and all... I still have no clue what to do with them.
Sorry, but i'm not familiar with the syntax of this language.
There are some helpful tutorials on the wiki, so I suggest you have a look there. They're a tiny bit out of date now, but they should still help.

Thank you, guys! I was able to make my own code for a Super jump and its works pretty ok! My problem is.. I cant seem to get this to work
when I'm on a Block-Like npc. Like a rocket engine block or a shy-guy. Is there anyway I could check if the player is on such objects?

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: SMB2 SuperJump

Postby PixelPest » Sat Jan 07, 2017 7:33 am

Well what's your code?

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Sat Jan 07, 2017 7:42 am

PixelPest wrote:Well what's your code?
Well... Its not the best, but its what I could do at my first crack at Lunalua.
Spoiler: show
-- Made by Ditchencat

local charge = 0;
local pwrUp = false;
local display = " ";
local ableToSJ = true;
local sfxPlay = false;
local maxC = false;
local inASJ = false;

function onLoop()

if maxC == true then
Defines.jumpheight = 30;
else
Defines.jumpheight = 20;
end

Text.print("Charge: ",20,20)
Text.print(charge,150,19)

-- Stuff I use for onscreen values so I can check if everything is working alright.

--Text.print(player:mem(0x02,FIELD_WORD),50,20)
--Text.print(player:mem(0x146,FIELD_WORD),50,80)
--Text.print(player:mem(0x34,FIELD_WORD),50,110)
--Text.print(player:mem(0x48,FIELD_WORD),50,140)
--Text.print(player:mem(0x112,FIELD_WORD),50,170)
--Text.print(maxC, 50, 200)
--Text.print(player:mem(0xE8,FIELD_WORD),50,230)
--Text.print(ableToSJ,50,50)

maxC = false;

if pwrUp == true then

charge = charge + 1;
if charge > 60 then

if sfxPlay == false then
Audio.playSFX(Misc.resolveFile("Charge.ogg"))
sfxPlay = true
end

charge = 60;
maxC = true;

end
end

if inASJ == true then

ableToSJ = true;

else

if player:mem(0x146,FIELD_WORD) == 2 or player:mem(0x48,FIELD_WORD) > 0 then
if player:mem(0x34,FIELD_WORD) == 0 then
if player:mem(0x112,FIELD_WORD) == 4 or player:mem(0x112,FIELD_WORD) == 5 then
ableToSJ = false;
else
ableToSJ = true;
end
else
ableToSJ = false;
end
else
ableToSJ = false;
end

end

end

function onKeyDown(Code)
display = Code;


if Code == 1 and ableToSJ == true then
pwrUp = true;
elseif Code == KEY_JUMP and maxC == true then
superJump();
elseif Code > 1 and inASJ == false or Code == 0 and inASJ == false then
pwrUp = false;
charge = 0;
end

end

function onKeyUp(Code)
if Code == 1 and maxC == true then
-- Youre fine
else
sfxPlay = false;
pwrUp = false;
charge = 0;
end
end


function superJump()
-- I need a particle system here.
-- Ive tried to use a particle api for this
-- but the particles disappear abruptly when the jump ends.
end

Super Mario Channel
Monty Mole
Monty Mole
Posts: 147
Joined: Sun Dec 06, 2015 8:08 am

Re: SMB2 SuperJump

Postby Super Mario Channel » Sat Jan 07, 2017 7:54 am

Ditchencat wrote:
PixelPest wrote:Well what's your code?
Well... Its not the best, but its what I could do at my first crack at Lunalua.
Spoiler: show
-- Made by Ditchencat

local charge = 0;
local pwrUp = false;
local display = " ";
local ableToSJ = true;
local sfxPlay = false;
local maxC = false;
local inASJ = false;

function onLoop()

if maxC == true then
Defines.jumpheight = 30;
else
Defines.jumpheight = 20;
end

Text.print("Charge: ",20,20)
Text.print(charge,150,19)

-- Stuff I use for onscreen values so I can check if everything is working alright.

--Text.print(player:mem(0x02,FIELD_WORD),50,20)
--Text.print(player:mem(0x146,FIELD_WORD),50,80)
--Text.print(player:mem(0x34,FIELD_WORD),50,110)
--Text.print(player:mem(0x48,FIELD_WORD),50,140)
--Text.print(player:mem(0x112,FIELD_WORD),50,170)
--Text.print(maxC, 50, 200)
--Text.print(player:mem(0xE8,FIELD_WORD),50,230)
--Text.print(ableToSJ,50,50)

maxC = false;

if pwrUp == true then

charge = charge + 1;
if charge > 60 then

if sfxPlay == false then
Audio.playSFX(Misc.resolveFile("Charge.ogg"))
sfxPlay = true
end

charge = 60;
maxC = true;

end
end

if inASJ == true then

ableToSJ = true;

else

if player:mem(0x146,FIELD_WORD) == 2 or player:mem(0x48,FIELD_WORD) > 0 then
if player:mem(0x34,FIELD_WORD) == 0 then
if player:mem(0x112,FIELD_WORD) == 4 or player:mem(0x112,FIELD_WORD) == 5 then
ableToSJ = false;
else
ableToSJ = true;
end
else
ableToSJ = false;
end
else
ableToSJ = false;
end

end

end

function onKeyDown(Code)
display = Code;


if Code == 1 and ableToSJ == true then
pwrUp = true;
elseif Code == KEY_JUMP and maxC == true then
superJump();
elseif Code > 1 and inASJ == false or Code == 0 and inASJ == false then
pwrUp = false;
charge = 0;
end

end

function onKeyUp(Code)
if Code == 1 and maxC == true then
-- Youre fine
else
sfxPlay = false;
pwrUp = false;
charge = 0;
end
end


function superJump()
-- I need a particle system here.
-- Ive tried to use a particle api for this
-- but the particles disappear abruptly when the jump ends.
end
Maybe Jump Bounce settings will help. Since those are still NPCs...

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Sat Jan 07, 2017 7:59 am

Super Mario Channel wrote:Maybe Jump Bounce settings will help. Since those are still NPCs...
???

Super Mario Channel
Monty Mole
Monty Mole
Posts: 147
Joined: Sun Dec 06, 2015 8:08 am

Re: SMB2 SuperJump

Postby Super Mario Channel » Sat Jan 07, 2017 8:06 am

Ditchencat wrote:
Super Mario Channel wrote:Maybe Jump Bounce settings will help. Since those are still NPCs...
???
Define.JumpBounce

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: SMB2 SuperJump

Postby PixelPest » Sat Jan 07, 2017 9:29 am

Super Mario Channel wrote:
Ditchencat wrote:
Super Mario Channel wrote:Maybe Jump Bounce settings will help. Since those are still NPCs...
???
Define.JumpBounce
No. That's not even it (Defines.jumpheight_bounce), however that wouldn't work anyway. When jumping off of an NPC with playerblocktop equal to 1, it's treated as a normal jump. You need to check if player.speedY is 0 and do an NPC.getIntersecting() for the space underneath the player

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: SMB2 SuperJump

Postby Hoeloe » Sat Jan 07, 2017 2:30 pm

PixelPest wrote:You need to check if player.speedY is 0 and do an NPC.getIntersecting() for the space underneath the player
Or you could be sensible and do it the non-dumb way by loading classExpander.lua and just using the "isOnGround" check. Even if you don't want to do that you can use player mem addresses to perform that check. No idea why you thought you'd need getIntersecting.

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: SMB2 SuperJump

Postby PixelPest » Sat Jan 07, 2017 3:40 pm

Didn't know that existed, so you'll want to check if the NPC:mem field 0x176 is greater than 0

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Sat Jan 07, 2017 3:47 pm

Check if the NPC:mem field 0x176 is greater than 0?

So I'd just put this in the section where I check if the player is on the ground, not in the water, etc?
Or am I being a tad on the dense side here?

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: SMB2 SuperJump

Postby Hoeloe » Sat Jan 07, 2017 4:35 pm

PixelPest wrote:Didn't know that existed, so you'll want to check if the NPC:mem field 0x176 is greater than 0
Again. You can just load the classExpander and there's literally a test for "isOnGround" which is much more reliable than doing it yourself.

Ditchencat
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 106
Joined: Wed Dec 28, 2016 7:28 pm

Re: SMB2 SuperJump

Postby Ditchencat » Mon Jan 09, 2017 6:21 am

I'm still confused as to what to do. I mean.. I only know what Pyro's videos taught me.
(And even then, I didn't watch them all yet due to the stuff i've needed to do recently.)


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari