T2008
Member
I want to have a NPC shoot at the player, moving towards player up until he's close and then stop and shoot. For some reason, even when he reaches stopping range, NPC still moves toward player. I've posted code below. Any ideas as to what is wrong???
Code:
if (distance_to_object(obj_player > 50)) {
mp_potential_step(obj_player.x,obj_player.y,3,obj_all_solid_parent);
direction_sprite_run();
} else if (distance_to_object(obj_player <= 50)) {
speed = 0;
npc_direction_sprite_attack_player();
}
Last edited: