aisdjioad
Member
I'm trying to use this code but it doesn't work since the x position of my player is ALWAYS lower or higher than the NPC's one. So the code reads it first and doesn't care about the Y position (which is supposed to make the NPC looks up and down).
GML:
if (keyboard_check_pressed(ord("Z"))) && (_check == false)
{
if (x < oPlayer.x)
{
image_index = 1;
}
else if (x > oPlayer.x)
{
image_index = 3;
}
else if (y < oPlayer.y)
{
image_index = 2;
}
else if (y > oPlayer.y)
{
image_index = 0;
}