Enemy direction

Sorry... I'm not sure if there's a simple way to do this or not, but I figured I'd throw it out and see if anyone could help.

I want my enemy sprites to behave like enemies from an old-school beat 'em up. So basically I want them to advance toward the player always facing left or right even when moving up and down, but when they are moving up and down I want them to remain facing the direction they were already facing.

I can always make the "up" and "down" portions of the sprite the enemy facing left or right but then they will always be facing a certain direction when moving up or down and I want them to always face the player.

If anyone can help or thinks they can help if I explain it a little better, it would be greatly appreciated.
I'd check the Direction Fix box below the graphic, and set a Custom Autonomous Move Route as follows:

Direction Fix OFFScript: set_direction(4) if $game_player.x < @xScript: set_direction(6) if $game_player.x > @xScript: set_direction([4,6][rand(1)]] if $game_player.x == @xDirection Fix ONDirection Fix is checked so the monster doesn't turn up or down if the player attacks them from above or below, and is turned off then on in the move route so it CAN change direction.If the player is to the left or right of the event, it will turn right or left accordingly. If the player is directly above or below the event (neither left nor right) it'll turn left or right randomly.

You do NOT need to set the event to parallel process for this to work. Just setting that in the Custom Autonomous Move Route will make it happen.
Amazing! Worked like a charm! Thanks so much.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/enemy-direction.17861/