How would this work for checking the Y axis?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By robdsmith92

This answer was very helpful however I can’t seems to translate this into verticality. I presumed it would be a case of adjusting the radian angle, and using flip_v. I can’t seem to get the math right. I have it so my enemy sprite is flipping correctly but only when the player moves to the left or right of the enemy, Changing the angle didn’t seem to work.

My code:

var angle = global_position.angle_to_point(player.global_position)
if abs(angle) > deg2rad(180):
	sprite.flip_v = true
else:
	sprite.flip_v = false

Any help would be greatly appreciated

:bust_in_silhouette: Reply From: SteveSmith
var angle = global_position.angle_to_point(player.global_position)
if abs(angle) < deg2rad(90) or abs(angle) > deg2rad(270):
    sprite.flip_h = true
else:
    sprite.flip_h = false