Page 1 of 1
How to put double jump?
Posted:
Thu Dec 20, 2007 5:16 pm
by Sondise
I know how to make the player jump once and multiplely, but I'd like for example, press space twice, it jumps twice.
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 6:00 pm
by asmodeus
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
}
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 6:21 pm
by Sondise
What's jumping code, yvelocity?
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 6:27 pm
by asmodeus
Yes. That code, that you use for jumping.
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 6:50 pm
by Sondise
I put yvelocity = -8. It didn't work. Is my code wrong?
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 6:57 pm
by asmodeus
Doesn't the player move upwards?
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 7:03 pm
by Sondise
Yeah, but it jumps just once in each game, then it doesn't jump anymore!
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 7:11 pm
by asmodeus
Here is an example. Maybe you understand then how to do.
Re: How to put double jump?
Posted:
Thu Dec 20, 2007 7:24 pm
by Sondise
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).
Re: How to put double jump?
Posted:
Sun Dec 23, 2007 9:37 am
by j2graves
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