how to make an actor follow another

Non-platform specific questions.

how to make an actor follow another

Postby Wolly08 » Fri Oct 19, 2007 8:53 pm

here is a script i just made.
Code: Select all
player1.yscreen=player2.yscreen;

or you could replace the y in yscreen for x
Wolly08
 
Posts: 39
Joined: Wed Jul 25, 2007 8:34 pm
Score: 2 Give a positive score

Re: how to make an actor follow another

Postby Game A Gogo » Fri Oct 19, 2007 11:17 pm

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.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: how to make an actor follow another

Postby DilloDude » Fri Oct 19, 2007 11:28 pm

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).
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: how to make an actor follow another

Postby Bannock » Sat Dec 01, 2007 7:41 am

What if you desired the actor who is following to stop a little way to the side of the actor who is leading?
User avatar
Bannock
 
Posts: 20
Joined: Tue Sep 11, 2007 7:59 am
Score: 2 Give a positive score

Re: how to make an actor follow another

Postby Fuzzy » Sun Dec 02, 2007 1:23 am

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.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron