I'm a little confused by how you ask your question, could you be a little more specific??
A code to get the angle from one coordinate to another would be this:
- Code: Select all
direction(x,y,x2,y2);
where x,y are the X & Y values of an actor and X2 & Y2 are the values of another actor
it's nearly the same code to get the distance:
- Code: Select all
distance(x,y,x2,y2);
So let's say you have the character named "player" and the enemy named "enemy". If you wanted the enemy to follow the player only when the player is within a certain radius of the enemy you could do this:
enemy->draw actor->script editor->
- Code: Select all
if(distance(x,y,player.x,player.y)<250)
{
angle = direction(x,y,player.x,player.y);
directional_velocity = 3;
}
else
{
directional_velocity = 0;
}
This will cause the enemy to follow the player at 3 pixels a frame if the player is within 250 pixels of the enemy, or stop moving if he is not.
Hope this helps somewhat, and if not you can explain further what you need.