Page 1 of 1

Jumping

PostPosted: Wed Aug 29, 2007 10:01 pm
by Kuraudo-sama
How would I make it so if a player jumps left he lands left, and if he jumps right he lands right?

Re: Jumping

PostPosted: Thu Aug 30, 2007 12:51 am
by Bee-Ant
First, make two variables :
1. right (actor variable, integer)
2. canjump (actor variable, integer)
note : you can make variable in script editor by click variables>add

on Draw Actor of your Player put this code :
Code: Select all
yvelocity=yvelocity+0.5;


on Collision Event with Anyside of Platform put this rule :
CollisionEvent>Anyside>Platform>PhysicalResponse>1 1 0 0

on Collision Event with Topside of Platform put this code :
Code: Select all
canjump=1;


on Collision Finish of Platform put this code :
Code: Select all
canjump=0;


on Create Actor put this code :
Code: Select all
canjump=1;
right=1;


on Keydown Event (to move right) put this code :
Code: Select all
x=x+3;
right=1;


on Keydown Event (to move right) put this code :
Code: Select all
x=x-3;
right=0;


on Keydown Event (to jump) put this code :
Code: Select all
if(canjump==1)
{
    if(right==1)
    {
         ChangeAnimation("EventActor","PlayerRight",FORWARD);
    }
    else
    {
         ChangeAnimation("EventActor","PlayerLeft",FORWARD);
    }
    yvelocity=yvelocity-10;
    canjump=0;
}


Hope help...

Re: Jumping

PostPosted: Thu Aug 30, 2007 4:42 pm
by Kuraudo-sama
Thank you, this works perfectly.