Stop the Flying

Talk about making games.

Stop the Flying

Postby ShingingDB » Sun May 06, 2007 1:19 am

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.
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Easy fix

Postby d-soldier » Sun May 06, 2007 1:45 am

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.
Last edited by d-soldier on Fri Jul 27, 2007 3:28 pm, edited 1 time in total.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby ShingingDB » Sun May 06, 2007 2:33 am

Ok thx Let me try.

Edit: Yes it works! Just that the fact that the gravity is too small. Time to tweak.
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby Rux » Sat May 12, 2007 4:55 pm

I used to use timers to jump,
thanks for showing an example! :D
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Postby ShingingDB » Sun May 13, 2007 6:24 pm

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?
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

hmm

Postby d-soldier » Sun May 13, 2007 8:16 pm

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.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby ShingingDB » Mon May 14, 2007 2:02 am

I don't really get it straight away. Hold up. Let me sit down and think about it.
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 0 guests

cron