Don't really understand why this is happening, could someone help?

D

Den

Guest
So i'm trying to make an enemy return back to a set path after being distracted by the player.
How I have it currently works in some places but not in others (which I don't get)
For example if the enemy is distracted to the right side of the path they return fine but if they go off to the left side
once they leave the distracted state they just appear back at the part of the path they saw the player and carry on
from there, rather than walking to the start of the path and carry on from there.

Here's the code for returning back to the path: (Spawn_Point is an object that's located where the path starts)
Code:
mp_linear_path(return_path, Spawn_Point.x, y, 1*room_speed, false);
path_start(return_path, path_spd, path_action_stop, false);
Here's the code for returning back to the patrol path:
Code:
if x == (Spawn_Point.x) && (path_index != Patrol_path)
{
        path_end();
        state = patrol_state;
        path_start(Patrol_path,path_spd, path_action_reverse,true);       
}
 
Top