how do you restrict jump?

Non-platform specific questions.

how do you restrict jump?

Postby savvy » Tue Jun 09, 2009 12:00 pm

i cant work out, how to prevent the charachter from jumping more than the amount of times i want them to.
any advice?
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: how do you restrict jump?

Postby Bee-Ant » Tue Jun 09, 2009 12:03 pm

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;
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: how do you restrict jump?

Postby savvy » Tue Jun 09, 2009 12:04 pm

ok, thanks.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: how do you restrict jump?

Postby Bee-Ant » Tue Jun 09, 2009 12:05 pm

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...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: how do you restrict jump?

Postby Bee-Ant » Tue Jun 09, 2009 12:08 pm

Oh yah...make sure you have only ONE event on those keydown...
I mean, only one script editor event each...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron