Welcome to the forums @NetherBoy!
You can flip a sprite using scale.x = -1
and flip it back using scale.x = 1
. For detecting the mouse, you can use something like this (untested):
var local_mouse_pos = get_local_mouse_position()
if (local_mouse_pos.x < 0):
scale.x = -1
else:
scale.x = 1
You can also use the flip_h property to flip a Sprite node horizontally as well, though children nodes will be unaffected.