Page 1 of 1

Stop the Flying

PostPosted: Sun May 06, 2007 1:19 am
by ShingingDB
I learned how to use GE from just using the caveman example. But in the caveman example, if you keep on pressing the jump button, he keeps on flying.

In my game, I want my player to jump once into the air, then fall back down onto the ground. But because I use the caveman example, the player just keeps on flying up.

How do I fix this problem? This is a really huge problem I need to fix.

I would like to fix it into a way where my actor will jump into the air, then fall back down within 1 sec, then fall back onto the ground/platform. Then he can jump again.

Thanks for the help.

Easy fix

PostPosted: Sun May 06, 2007 1:45 am
by d-soldier
The reason he can keep jumping is because the keydown event isn't limited. Heres what you need to do:
1) Click up on SCRIPT menubar, then add an actor variable called "canjump".

2)On your players events, add a collision event (relating to the ground) with a script editor that says:
"canjump = 1;"

3)On your players keydown event (for whatever your jump button is)make the script say:
if(canjump==1)
{
yvelocity = -8;
canjump=0;
}

4) And that ought to do it! Basically it makes your player only be able to jump if his feet are on the ground. Keep in mind that if you add any other ground objects/platforms/etc. you will need to have that collision event for the player with each of them too.

PostPosted: Sun May 06, 2007 2:33 am
by ShingingDB
Ok thx Let me try.

Edit: Yes it works! Just that the fact that the gravity is too small. Time to tweak.

PostPosted: Sat May 12, 2007 4:55 pm
by Rux
I used to use timers to jump,
thanks for showing an example! :D

PostPosted: Sun May 13, 2007 6:24 pm
by ShingingDB
Is there a way that, if the player is not touching a platform, he will change animation to either right jump or left jump depending which way he's pointing at?

hmm

PostPosted: Sun May 13, 2007 8:16 pm
by d-soldier
You will have do do some scripting for that...see:
http://game-editor.com/forum/viewtopic.php?t=3319
check page 2 at the top, Sgt. Sparky lays out some scripting regarding the direction the actor is moving. You will probably need to adjust that to animindex to figure in the sprites for the player standing still as well.

PostPosted: Mon May 14, 2007 2:02 am
by ShingingDB
I don't really get it straight away. Hold up. Let me sit down and think about it.