You need to have a limiting variable, that tells the actor that he is not allowed to jump.
When his feet touch the ground again(collide with ground) you set this variable to 0, or whatever number represents an allowance to jump.
Before you jump(after the keydown event), check to see if he is allowed to jump(use my Mortal Enemy, the 'if' statement). I dont normally recomend him, but this time I will.
to cap it off... at the beginning of your jump script, put
- Code: Select all
if(IsJumping == 0)
{
IsJumping = 1;
(Jump code here)
}
Notice that I used two = after if. i just about forgot. You shouldnt forget either.
in the collision event add this script
- Code: Select all
IsJumping = 0;
IsJumping = 1 means that he is busy jumping. IsJumping = 0 means he is not. Also, turn off key repeat on the jump key.