Is there a stop movement command

Non-platform specific questions.

Is there a stop movement command

Postby zxcvbnm » Fri Dec 10, 2010 6:12 pm

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.
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: Is there a stop movement command

Postby skydereign » Sat Dec 11, 2010 1:06 am

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
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest