#How to flip sprite horizontally when moving right

3 messages · Page 1 of 1 (latest)

river flame
#

I am trying my hand at Godot right now and while I have a player on the screen and can move them around the screen I'd like to flip the sprite horizontally when I am going right. I did some Googling and found $Sprite.flip_h = true but I get an error when using that (see attached image). I also tried setting scale to -1 and 1 but it had some weird results. I am using Godot 4.0.3.stable and am hoping someone can help me.

finite galleon
#

Try setting the $Sprite as a variable, like @onready var sprite = $Sprite and then doing sprite.flip_h = true, that works for me
Also it might be $Sprite2D in your case, not really sure.

lethal solar
#

You got it right, but it's $Sprite2D, not $Sprite 😛