Flipping the player, Including damage colliders

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

Hello, This is my first question and I’m new to godot. For testing I’m creating small platforms and I used sprite’s $Sprite.flip_h for flipping the player. Now i want to implement player attack so i created a collider on players front side. Now the problem is flipping the player by sprite, Hotbox does not flip itself.
If i make hotbox as a child of Sprite it maybe flip with sprite node. but I don’t move hotbox into the Sprite node.
Here i attached some screenshots of my project hierarchy, Please let me know if you know a better solution.

enter image description here
enter image description here

:bust_in_silhouette: Reply From: njamster

Just invert the scale-property of your Player-node.

The default is (1, 1). If you set it to (-1, 1) you will flip it horizontally. If you set it to (1, -1) you will flip it vertically. Note that this is different from flipping a sprite, where just the texture is flipped, not the node itself! So no, even if the Hitbox-node would be a child of your Sprite-node, setting the flip_h-property wouldn’t flip the hitbox.

Btw: A “Hotbox” is something very different. :wink: Sorry, could not resist.

Thanks for the answer! Hot box is my own very unique component :wink:

juju | 2020-03-01 01:29