Page 1 of 1

Following another charactor

PostPosted: Thu Apr 20, 2006 4:09 am
by next2sin
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??

PostPosted: Wed May 03, 2006 6:10 am
by DilloDude
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.