Following another charactor

Talk about making games.

Following another charactor

Postby next2sin » Thu Apr 20, 2006 4:09 am

How do you make an enemy on a path follow a charector when it comes into view and as soon as the enemy leave charectors view continue its path??
next2sin
 
Posts: 3
Joined: Tue Apr 11, 2006 1:01 am
Score: 0 Give a positive score

Postby DilloDude » Wed May 03, 2006 6:10 am

On enemy->DrawActor->script editor, write
Code: Select all
if (distance(x, y, Character.x, Character.y) < [value for distance])
{
    angle = direction(x, y, Character.x, Character.y);
    directional_velocity = [enter a value here];
}
else
{
    directional_velocity = 0;
}

that will make it so the enemy always moves toward you if you're close enough. If you want it to turn with a limited angle, rather than always pointing directly toward you, let me know, I have a script to do this.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest