How can I flip a CollisionPolygon2D?

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

hi there,

the title sums it up; I am trying to flip a CollisionPolygon2D so that, when my player node moves left and right, the collision flips along with the sprite. There is no method or property that seems to accomplish it, and I can’t seem to reshape the node either, so I am at a loss. If there is any information I can provide, I will be happy to.

Thanks.

:bust_in_silhouette: Reply From: johnygames

You could simply turn the scale value to -1 in the x axis. This will effectively flip it.

polygon_to_be_flipped.scale.x = -1

Excellent, thanks.

yerbestpal | 2020-08-15 13:41