Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ping-Pong loop mode for AnimatedSprite2D #11698

Open
danikaze opened this issue Feb 4, 2025 · 3 comments
Open

Add Ping-Pong loop mode for AnimatedSprite2D #11698

danikaze opened this issue Feb 4, 2025 · 3 comments

Comments

@danikaze
Copy link

danikaze commented Feb 4, 2025

Describe the project you are working on

Generic and basic 2D project

Describe the problem or limitation you are having in your project

Looping animations is possible with AnimatedSprite2D but they always loop frames as 1, 2, 3, 1, 2, 3...

Looping in ping-pong mode is a very common use case, the same way as it was added for Tilemaps: 1, 2, 3, 2, 1, 2, 3, 2, 1...

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would be nice if there was a bool under the Animation properties for a tile that I could click on which set it so that when the tile animation reached the end, it would reverse the frame order and go backwards right to the start.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It could be a bool added between the loop icon, or a selector if other modes are added (are there?)

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can, but having to add the script to manage every possible animation with a simple state machine, or even duplicate the number of frames... but it would be a hassle and it's better if it's an animation property that can be enabled/disabled programmatically.

Is there a reason why this should be core and not an add-on in the asset library?

This is a very common animation functionality in games (for walking, actions, blinking eyes, moving mouths, etc. etc.)

@AThousandShips
Copy link
Member

This would be implemented under SpriteFrames I'd say per animation, as looping in general is handled there and not in AnimatedSprite2D

@LeonStansfield LeonStansfield marked this as a duplicate of #11697 Feb 4, 2025
@danikaze
Copy link
Author

danikaze commented Feb 4, 2025

How is this a duplicated of #11697 ?

@danikaze
Copy link
Author

danikaze commented Feb 4, 2025

This would be implemented under SpriteFrames I'd say per animation, as looping in general is handled there and not in AnimatedSprite2D

Yes, in the same level as the Loop flag, which is applied per animation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants