Hi, I'm making a game a top-down 8-direction movement perspective. One of the basic AI systems most of my enemies have is one that allows them to follow the player, it's a very simple implementation with no frills, just "if the player is here, simulate movement in this direction" like so.
(obj_legs is my player's body hitbox object)
The problem is, when they align with the player on the X or Y axis, they constantly switch between up/down or left/right, causing this weird slow and jittery movement. Is there a better way to do this real simple AI that would prevent that?