How do I make a sprite flip depending on which direction the obj is moving

Im trying to code an rpg and I have ran into a small problem. I cant get the mob's sprites to flip left or right when following the player, currently they just face right. Also I want them to wander in a small area and need them their images to flip depending on which way they are moving.
 
A really simple way is to use a negative value for image_xscale.
A value of -1 will flip it horizontally, giving the impression of facing the opposite direction.
A common practice is to have your basic sprite facing right (the 0* direction in GM), and flip your sprite with image_xscale = -1; to make it face to the left.
You can also use this trick in isometric games, as "down" and "right" are the same flipped sprite, as are "up" and "left"
 
Last edited:
I can flip the sprite my problem is making it do it so that it faces the direction its moving. I don't know how to check which direction it moving.

A really simple way is to use a negative value for image_xscale.
A value of -1 will flip it horizontally, giving the impression of facing the opposite direction.
A common practice is to have your basic sprite facing right (the 0* direction in GM), and flip your sprite with image_xscale = -1; to make it face to the left.
You can also use this trick in isometric games, as "down" and "right" are the same flipped sprite, as are "up" and "left"

This is what Im using to make the enemy move.
move_towards_point(objPlayer.x, objPlayer.y, walkspeed);
if (distance_to_object(objPlayer) < awareradius)
{
walkspeed = 2
}
else
{
walkspeed = 0
}};
 
Top