Aerosol Posted March 23, 2009 Report Share Posted March 23, 2009 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 More sharing options...
mattt360 Posted March 23, 2009 Report Share Posted March 23, 2009 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 More sharing options...
Asuma Posted March 23, 2009 Report Share Posted March 23, 2009 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 More sharing options...
USC Posted March 23, 2009 Report Share Posted March 23, 2009 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 More sharing options...
Kain Posted March 23, 2009 Report Share Posted March 23, 2009 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 More sharing options...
mattt360 Posted March 24, 2009 Report Share Posted March 24, 2009 Kain: isn't that just making a state variable? Link to comment Share on other sites More sharing options...
Kain Posted March 24, 2009 Report Share Posted March 24, 2009 You could do it with state the variable, but for some reason I can't remember at this time, I encountered problems when I tried to do it that way. Maybe I just didn't like changing between states midair for no obvious reason. Link to comment Share on other sites More sharing options...
Recommended Posts