Page 1 of 1

Following an actor

PostPosted: Sat Jul 14, 2007 5:48 pm
by Freddy
How do I make an actore follow another actor, only on the x axis?

PostPosted: Sat Jul 14, 2007 6:47 pm
by pixelpoop
on the draw actor script of the one doing the following:

x=actor.x;

PostPosted: Sat Jul 14, 2007 7:26 pm
by Freddy
Thanks, but how can I make my following actor travel at a certain speed?

PostPosted: Sat Jul 14, 2007 10:52 pm
by d-soldier
Draw Actor script: Adjust the "50" to get different results: Change the "actortofollowhere" to the actor's name.

int weight = 50;
x = ((weight -1)*x + actortofollowhere.x)/weight;
y = ((weight -1)*y + actortofollowhere.y)/weight;

PostPosted: Sun Jul 15, 2007 6:14 pm
by Freddy
ok, i made the variable for weight and i used the code for the x axis, but no matter how i tweek it, the following actor allways wants to go to one side of the scree. :?

PostPosted: Sun Jul 15, 2007 6:31 pm
by Freddy
Never mind!!!! :D :D :D :D
I figured it out.
Thanks soooo much

PostPosted: Sun Jul 15, 2007 6:35 pm
by d-soldier
Good, and for future reference, no "weight" variable needs to be created.