Page 1 of 1

Is there a stop movement command

PostPosted: Fri Dec 10, 2010 6:12 pm
by zxcvbnm
Ok let me explain the question . Lets say I have a charactor and it moves on its own . Lets say the code is

x+=5;

Now lets say when the actor collides with an object , how can I make it stop. I can do it now but I know thier is an easier way.

Re: Is there a stop movement command

PostPosted: Sat Dec 11, 2010 1:06 am
by skydereign
You can use PhysicalResponse, ToAnteriorPosition, or switch the x+=5 to xvelocity=5 on its create. That way you can stop the movement with xvelocity=0. If none of those are appropriate, you'll have to use a variable to determine if the actor should be moving.
Code: Select all
if(moveVar==1)
{
    x+=5;
}

// or if you don't like the if
x+=moveVar*5;
// moveVar = 1 is move right
// moveVar= 0 don't move
// moveVar = -1 is move left