hi,
is there a way to make an actor move to but just on the x axis?
i know there is a way with
actor.x=player.x;
but this would be to fast, i want him slowly fallow like in movto...
x+=5;
if (p.x > x+5)
{
x+=5;
}
else if (p.x < x-5)
{
x-=5;
}
MoveTo("Event Actor", 0.000000, y, 1.000000, "TARGET", "");
//moves only to the x value of the target, y is the same as the actors current y value
//meaning that the y value doesnt move!
NERDnotGEEK wrote:If you want him to follow player you use what skydereign said but put it in say an if statement.
- Code: Select all
if (p.x > x+5)
{
x+=5;
}
else if (p.x < x-5)
{
x-=5;
}
the + and - 5 in the if statement just makes it so the thing that's following doesn't shake when its dead in line with the player
x+=5*((p.x>x-5)-(p.x<x-5));
if(PLAYER.x<x&&PLAYER.x>x -250)
{
x-=5;
ChangeAnimation("Event Actor", "PLAYERRUNLEFT", NO_CHANGE);
}
if(PLAYER.x>x&&PLAYER.x<x +250)
{
x+=5;
ChangeAnimation("Event Actor", "PLAYERRUNRIGHT", NO_CHANGE);
}
Users browsing this forum: No registered users and 1 guest