Jumping

Talk about making games.

Jumping

Postby Kuraudo-sama » Wed Aug 29, 2007 10:01 pm

How would I make it so if a player jumps left he lands left, and if he jumps right he lands right?
Kuraudo-sama
 
Posts: 12
Joined: Wed Jul 25, 2007 4:42 am
Score: 1 Give a positive score

Re: Jumping

Postby Bee-Ant » Thu Aug 30, 2007 12:51 am

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...
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: Jumping

Postby Kuraudo-sama » Thu Aug 30, 2007 4:42 pm

Thank you, this works perfectly.
Kuraudo-sama
 
Posts: 12
Joined: Wed Jul 25, 2007 4:42 am
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron