View Full Version : Game troubles - Jumping

02-26-2005, 02:26 AM
I'm having a little bit of trouble with making my character jump.

I've set boundaries and used some gravity script I found on another site but when I use the Key.isDown(Key.UP) { _y -= 25; } function, I have a problem where he stays up if you hold the key down.

I've tried using things like a while loop that the up key functions until the character hits a certain point but the game doesn't like that while loop and it freezes.

I've tried different methods but to no avail.

Can anyone help? :confused:

02-26-2005, 03:55 AM
It depends on how you want it to work, but one way to do it would be to set a variable at the start and increment it each frame/iteration, and when it's too high you make the character stop going up and thus start to fall.

02-26-2005, 04:08 AM
That does sound like a good concept but then the main thing is that I have to use/create some kind of function that will cut out the incrementation until he hits the floor.

Otherwise as long as the key is being pressed it will continue to increment until it reaches the cut off point but then without disabling the Key.UP movement it will continue to increment even when it gets say half way down to the ground as long as the key is being pressed.