Do you mean if the player is facing right, the object should face left (regardless of whether the object is to the left or right of the player)? Or that if the player is to the left of the object, the object should face right? It also depends on how you've set other things up, such as the sprite. How you draw things, such as the sprite. Orientation, such as top down or platformer. And so on.
For the first, you simply need to know which way the player is facing. This could be determined in a lot of different ways depending upon how you have set other things up. For example,
sign(image_xscale) would work in some situations (e.g. 2D platformer where you use image_xscale to determine facing). Or
point_direction(0, 0, hsp, vsp); would work in others (e.g. 2D top-down with full 360 motion).
For the second you need to know the direction to the player. So for example:
Code:
if (instance_exists(obj_player)) {
dir_to_player = sign(obj_player.x - x);
}
But again, you probably need to be more detailed in what you are looking for and how other things are set up.