Page 1 of 1

how do you restrict jump?

PostPosted: Tue Jun 09, 2009 12:00 pm
by savvy
i cant work out, how to prevent the charachter from jumping more than the amount of times i want them to.
any advice?

Re: how do you restrict jump?

PostPosted: Tue Jun 09, 2009 12:03 pm
by Bee-Ant
make a variable called "jump"
Put this code on keydown to jump
Code: Select all
if(jump==1)
{
    yvelocity-=15; //or any value you want
    jump=0;
}

Put this code on collision with platform
Code: Select all
jump=1;

Re: how do you restrict jump?

PostPosted: Tue Jun 09, 2009 12:04 pm
by savvy
ok, thanks.

Re: how do you restrict jump?

PostPosted: Tue Jun 09, 2009 12:05 pm
by Bee-Ant
to make a double jump put this code on keydown to jump
Code: Select all
if(jump>0)
{
    yvelocity-=15;
    jump--;
}

put this code on collision with platform
Code: Select all
jump=2; //2 for double jump, 3 for triple jump, etc...

Re: how do you restrict jump?

PostPosted: Tue Jun 09, 2009 12:08 pm
by Bee-Ant
Oh yah...make sure you have only ONE event on those keydown...
I mean, only one script editor event each...