Unit 3 Design a Game, turn sprite in opposite directions


A student of mine wants to turn enemy.1 sprite in the direction that it is moving to chase the player. Anyone have a suggestion on how to do this?

Screen Shot 2021-05-21 at 3.34.23 PM

You can compare the position of the player with the position of enemy1 to get the direction the zombie is walking in. Here’s how I would do it:
if(player.x > enemy1.x){
enemy1.setAnimation(“zombie walking right”)