0 votes

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

in Engine by (77 points)

Use 2D shader to flip the image?

2 Answers

+2 votes
Best answer

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.

by (14,834 points)
selected by

Thx it worked

0 votes

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
by (14 points)

I meant flipping the texture not rotating it

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.