Page 1 of 1

Common Question Regarding Jumping.

PostPosted: Thu Jan 12, 2006 6:14 am
by bean59
Here is my problem. I have my character set up to jump when space bar is hit. Gravity is set up too. It all works but you can do infinite about of jumps in the air and fly off.

I know there are forums regarding this but I am extremely newb and need an easy explanation on how to disable the space key once he is in the air, and you can only use it once it you touch back down.

What ever methods you have post em because I only have 2 days left until my project is due for school and I REALLY NEED ANYONES HELP! :(

PostPosted: Thu Jan 12, 2006 9:07 am
by Novice
Create a integer variable canJump.
On Collision with ground canJump=1.
On jump button
Code: Select all
if (canJump==1)
{
yvelocity=-5;
canJump=0;
}

PostPosted: Fri Jan 27, 2006 1:09 am
by DilloDude
I have experimented with this too, but I discovered that if you have the jump variable change when you jump, you can walk of a platform and then jump in the air. If you are using a draw actor
Code: Select all
yvelocity+=.5
for gravity and a physical response with ground, a collision finish event doesn't work to change the variable to 0. What I have is on collision with any side of ground, change the jump variable to 1 and create a timer for a very short time, about 100 or 200 milliseconds. (I am also trying having a destroy timer before the create timer). Make this event repeat. (make sure you use a different event that dosen't repeat for the physical response. For any other platforms, use the same thing, but make the collision only on the top side, or you can jump constantly up a wall or even along the roof.
Hope people find this useful. 8)

PostPosted: Sat Jan 28, 2006 12:00 am
by Novice
Or you could just do this
Code: Select all
if (player.y>player.yprevious+5) canJump=0;

I havent given much tought about this problem because i havent tried to make a platform game, but i think this should work fine.
The +5 in the code is to make sure that the player isnt just going over some rough terain so it should be changed acording to the bumpines of your terain. I didnt try it out so let me know if it works.

PostPosted: Mon Aug 28, 2006 5:56 pm
by Jokke
cant u set the player to jump for certain seconds instead? so after pressing space the character keeps going up untill the time "expires" and then fall to the ground...

dont judge me, im a n00b XD

Re: Common Question Regarding Jumping.

PostPosted: Tue Sep 05, 2006 5:46 pm
by Troodon
bean59 wrote:Here is my problem. I have my character set up to jump when space bar is hit. Gravity is set up too. It all works but you can do infinite about of jumps in the air and fly off.

I know there are forums regarding this but I am extremely newb and need an easy explanation on how to disable the space key once he is in the air, and you can only use it once it you touch back down.

What ever methods you have post em because I only have 2 days left until my project is due for school and I REALLY NEED ANYONES HELP! :(


Hi everybody! I don't know if somebody still remembers me. :wink:
I see that these question is very common in game editor forum. Allways there is somebody who asks it. Couldn't there be a tutorial or a forum sticky to pretend it to be always asked again and again?

PostPosted: Tue Sep 05, 2006 11:12 pm
by SergeLo00001
there is a tutorial on how to make gravity and how to make ur character jump, but it never shows you how to fix this problem many are having. even playing the tutorial after seeing it you wil notice that you can keep jumping.

PostPosted: Wed Sep 06, 2006 1:13 pm
by Troodon
I know.
Maybe in the next version ((which is the newest version of game-editor?)) there will be a demo/tutorial that shows the little simple variable trick that disables the jumping before first retouching the ground.

PostPosted: Wed Sep 06, 2006 10:54 pm
by Game A Gogo
just change the variable when he dos a colision on the ground

PostPosted: Thu Sep 07, 2006 9:48 pm
by SergeLo00001
explain to me how to do that game a gogo plz

PostPosted: Thu Sep 07, 2006 11:07 pm
by Game A Gogo
canjump=0;

PostPosted: Sat Sep 09, 2006 7:56 am
by Troodon
Make a variable called 'canjump'.
Then in create actor, make canjump=1.
When you press the jump key, canjump=0.
You can jump only when canjump=1.
When collision with the terrain actor, canjump=1.

PostPosted: Sat Sep 09, 2006 8:56 pm
by The achievement
I had so many problems with this jumping. But i finally got it down,(after so many posts) i used the the solution like DilloDude. i used a timer on when you can jump. but the canJump works very well to. its really not that hard, in fact its very easy. Just takes some time. :D