0 votes

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

in Engine by (18 points)

1 Answer

0 votes
Best answer

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. ;) Sorry, could not resist.

by (10,467 points)
selected by

Thanks for the answer! Hot box is my own very unique component ;)

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 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 webmaster@godotengine.org with your username.