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