Page 1 of 1

Varying jump height help

PostPosted: Thu Sep 01, 2011 2:14 pm
by j2graves
I'm working on a game that involves platforming. One thing that I want to happen is that when a player taps the jump button, the player actor will jump a certain height. If however, the player holds in the button, the actor will jump higher until the player lets go of the button. I know that one way to do this is to do keyup/script editor/ " yvelocity = 0; ", But the thing is, this means that if a player taps the button quickly, the actor will stop moving upward just a tiny bit above the ground. I want this only to happen after a set time period, but I don't want to use timers, because timers don't account for the possibility of lag. Does anyone understand what I want? Could someone help me?

Re: Varying jump height help

PostPosted: Thu Sep 01, 2011 3:36 pm
by ikarus
I'm not making a platformer yet but I think you could probably disableEvent the key up events when the user presses jump then start a timer for like a second that enables it when it goes off. Not sure if it would carry over the the keyup though after it's enabled. Maybe make an actor variable and have the keypressed turn it on and off with another for a counter so it can tell how far it's jumped then it turns itself off if the jump is no longer pressed and a certain time is met. That's my guess

Re: Varying jump height help

PostPosted: Thu Sep 01, 2011 10:38 pm
by skydereign
What you want is what people here seem to call a velocity jump. Here is a tutorial on it.
http://game-editor.com/forum/viewtopic.php?f=2&t=8614&p=74888&

Re: Varying jump height help

PostPosted: Fri Sep 02, 2011 4:42 pm
by j2graves
Thanks. I had to make some slight changes, but that worked. :D