What you could do is choose whether to look left/right or up/down based on how far the player is from each of these axis. Create a Boolean attribute and call it "horizontal* or something like that then in the when updating do this code.
Set horizontal to <(absolute value of ((x of self)-(Alex x)))>(absolute value of ((y of self)-(Alex y))>
If it's true then face horizontally and otherwise face vertically