[SOLVED]MP Potential Step AI Movement Not Working

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:
I don’t know TOO well but maybe, I know that speed usually turns green but maybe if you have other variables like vertical_speed or same thing with horizontal set those to 0 or set image speed to zero too
 

T2008

Member
Thanks. That was a very sloppy error. I had copied and pasted from other code and didn't notice parenthesis were off. Thanks again
 
Top