Varying jump height help

Non-platform specific questions.

Varying jump height help

Postby j2graves » Thu Sep 01, 2011 2:14 pm

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?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Varying jump height help

Postby ikarus » Thu Sep 01, 2011 3:36 pm

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
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Varying jump height help

Postby skydereign » Thu Sep 01, 2011 10:38 pm

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&
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Varying jump height help

Postby j2graves » Fri Sep 02, 2011 4:42 pm

Thanks. I had to make some slight changes, but that worked. :D
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest