Add flipped_horizontally
and flipped_vertically
signals for Sprite2D
, AnimatedSprite2D
and SpriteBase3D
#99634
+74
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Completes: godotengine/godot-proposals#5146
In that proposal, the author noted mentioned the following:
According to the reference, the
frame_refreshed
will be emitted on the change offlip_*
. But sadly, the signal was obsolescent.Meanwhile, there has been a lot of discussions and proposal duplicates about complaining getting unexpected result from a scale like (-1, 1) and the users wanted to figure out a way to the solution and put their hope on
flip_*
. Because we don't haveproperty_changed
signal forObject
, which could be costly for the performance, I implemented a pair of signals for some nodes such asSprite2D
,AnimatedSprite2D
andSpriteBase3D
that have members beginning withflip_
, which will be emitted on the change of these members.By connecting this signal to other sprites, one can easily achieve the flipping synchronization and safe reflection on single axis (negative X/Y scale without polluting the global rotation):