Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Variable jumping


Aerosol

Recommended Posts

Yea, I know this is considered rather basic but bah.

Can someone explain to me the basic concept behind variable jumping? Much like how one would explain static movement as "adding a constant to a speed variable and adding that variable to the object's current x/y position". Thanks guys.

Link to comment
Share on other sites

ok...variable jumping? you mean like in 3D games how they make players jump?

you just need three variables-players value, speed value, and gravity, witch ill name z, zspd and grav.

now, z is the players height.

if the player presses space: zspd=(put vertical speed here)

constatly:

z=z-zspd

zspd=zspd-grav

now, you'll just wanna change all the z to y

well, i hope i helped, let me know if that dont work.

Link to comment
Share on other sites

Yea, I know this is considered rather basic but bah.

Can someone explain to me the basic concept behind variable jumping? Much like how one would explain static movement as "adding a constant to a speed variable and adding that variable to the object's current x/y position". Thanks guys.

Do you mean like when you hold shift the player jumps high but as soon as you let o of shift, he falls?

Link to comment
Share on other sites

If I remember correctly, the MMF event works like this...

(While holding Jump button; Jump counter < 8) -> Add 1 to Jump counter...

Basically, for every second you hold the Jump button, Sonic's jump gets stronger. If you let go before it hits 8, Sonic won't jump as high as possible, and your gravity conditions will start to pull him down.

Does that help?

Link to comment
Share on other sites

I believe the way it's done for most platformer games is whenever you jump, a certain trigger variable is set to 1 (this variable is set to 0 whenever you land, start going downwards or get propelled by a gimmick). If that trigger variable is 1 and you are not holding/pressing jump and you are going up at a certain speed or more (I think ~2.5 pixels/second is about right), then you set your vertical speed to that speed. In other words, if you let go of jump while being propelled up from the jump, then your speed is reduced to a certain amount.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...