How to flip h a line2d?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By trien

I made a line2d as a player texture and i wanna flip it when the player left or right but there is no flip_h in the line2d class so how do i do it

Use 2D shader to flip the image?

ponponyaya | 2022-03-12 09:22

:bust_in_silhouette: Reply From: sunaki

you can rotate your Line2D by 180 degrees when pressing left

line2d.rotation_degrees = 180

and rotate it back to 0 when pressing right

line2d.rotation_degrees = 0

I meant flipping the texture not rotating it

trien | 2022-03-15 18:03

:bust_in_silhouette: Reply From: jgodfrey

You can flip the Line2D horizontally by setting its scale.x property to -1. If you also want to flip other related elements at the same time, you can parent them all to a common Node2D and set its scale.x to -1 instead.

Thx it worked

trien | 2022-03-12 15:54