How to put double jump?

Talk about making games.

How to put double jump?

Postby Sondise » Thu Dec 20, 2007 5:16 pm

I know how to make the player jump once and multiplely, but I'd like for example, press space twice, it jumps twice.
User avatar
Sondise
 
Posts: 94
Joined: Thu Nov 01, 2007 11:04 pm
Location: South america
Score: 0 Give a positive score

Re: How to put double jump?

Postby asmodeus » Thu Dec 20, 2007 6:00 pm

Create a variable and call it can_jump. Use this code in the key_down event (space):
Code: Select all
if(can_jump<2)
{
    can_jump += 1;
    // your jumping code
}
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: How to put double jump?

Postby Sondise » Thu Dec 20, 2007 6:21 pm

What's jumping code, yvelocity?
User avatar
Sondise
 
Posts: 94
Joined: Thu Nov 01, 2007 11:04 pm
Location: South america
Score: 0 Give a positive score

Re: How to put double jump?

Postby asmodeus » Thu Dec 20, 2007 6:27 pm

Yes. That code, that you use for jumping.
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: How to put double jump?

Postby Sondise » Thu Dec 20, 2007 6:50 pm

I put yvelocity = -8. It didn't work. Is my code wrong?
User avatar
Sondise
 
Posts: 94
Joined: Thu Nov 01, 2007 11:04 pm
Location: South america
Score: 0 Give a positive score

Re: How to put double jump?

Postby asmodeus » Thu Dec 20, 2007 6:57 pm

Doesn't the player move upwards?
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: How to put double jump?

Postby Sondise » Thu Dec 20, 2007 7:03 pm

Yeah, but it jumps just once in each game, then it doesn't jump anymore!
User avatar
Sondise
 
Posts: 94
Joined: Thu Nov 01, 2007 11:04 pm
Location: South america
Score: 0 Give a positive score

Re: How to put double jump?

Postby asmodeus » Thu Dec 20, 2007 7:11 pm

Here is an example. Maybe you understand then how to do.
Attachments
jumping.zip
(1.04 KiB) Downloaded 117 times
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: How to put double jump?

Postby Sondise » Thu Dec 20, 2007 7:24 pm

Thanks, I understood now. I think the problem was the draw actor. You didn't tell me that and i put a different code (yvelocity = yvelocity + .5).
User avatar
Sondise
 
Posts: 94
Joined: Thu Nov 01, 2007 11:04 pm
Location: South america
Score: 0 Give a positive score

Re: How to put double jump?

Postby j2graves » Sun Dec 23, 2007 9:37 am

also, you need to put a collision event for the top side of the tile actor, and write
Code: Select all
can_jump = 2;

then he will be able to jump again after he has landed
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 Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron