Page 1 of 1
how to make an actor follow another
Posted:
Fri Oct 19, 2007 8:53 pm
by Wolly08
here is a script i just made.
- Code: Select all
player1.yscreen=player2.yscreen;
or you could replace the y in yscreen for x
Re: how to make an actor follow another
Posted:
Fri Oct 19, 2007 11:17 pm
by Game A Gogo
also
player1.y=player2.y;
as yscreen and xscreen are just the position of an actor on the screen, o,o being the top left corner.
Re: how to make an actor follow another
Posted:
Fri Oct 19, 2007 11:28 pm
by DilloDude
using xscreen and yscreen has an advantage over x and y: x and y are relative to the actor's parent (if there is one). xscreen and yscreen are always relative to the view. So, if one actor has a different parent than the other, using x and y will get weird results. Using xscreen and yscreen will fix the problem. (same with getting distance and direction).
Re: how to make an actor follow another
Posted:
Sat Dec 01, 2007 7:41 am
by Bannock
What if you desired the actor who is following to stop a little way to the side of the actor who is leading?
Re: how to make an actor follow another
Posted:
Sun Dec 02, 2007 1:23 am
by Fuzzy
Bannock wrote:What if you desired the actor who is following to stop a little way to the side of the actor who is leading?
Use the distance function to measure and unattach parent if he gets too close.