compare the mouse position to the player position.
if you really want to rotate the sprite just set it's angle : angle(sprite.x,sprite.y,mouse.x,mouse.y)
if you want to mirror the sprite depending on mouse.x
system compare two values: mouse.x > player.x
if you only want to do it while moving add a condition for is moving and set the animation based on the destination.
Everything is possible, but because it's unclear to me what you are expecting I'll leave it at these three examples.