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

AnimatedSprite doesn't emit animation_finished when changing playback direction #61078

Closed
akien-mga opened this issue May 16, 2022 · 1 comment · Fixed by #61085
Closed

AnimatedSprite doesn't emit animation_finished when changing playback direction #61078

akien-mga opened this issue May 16, 2022 · 1 comment · Fixed by #61085

Comments

@akien-mga
Copy link
Member

akien-mga commented May 16, 2022

Godot version

3.x (ddc14b6), master (d6e7dcb)

System information

Mageia 9 Linux, x86_64

Issue description

AnimatedSprite (AnimatedSprite2D in master) seems to behave differently from AnimationPlayer with regard to emitting the animation_finished signal when the animation ends, if the playback direction has changed (e.g. starting playing forwards, then playing backwards).

In the attached project, the animation is played forward and properly emits animation_finished when it ends. The animation_finished callback then plays the animation again but backwards, and there the animation_finished signal is not emitted when reaching the end (first frame).

Similarly, if starting by playing backwards, then the animation_finished signal is properly emitted when it reaches the first frame. But if we then restart the animation forwards, the signal is not emitted when reaching the last frame.

So it looks like the way the animation is played the first time defines what the "end" condition is and does not adapt to changes in playback direction. On the other hand, AnimationPlayer seems to handle the above scenario fine, and emits animation_finished on the last frame if playing forward, and on the first frame if playing backward.

Note: Loop should be disabled for the AnimatedSprite, otherwise it conflicts with the above ping-pong looping implementation.

Steps to reproduce

  • Add AnimatedSprite animation with a few frames, with Loop disabled
  • Play it forward, then when animation_finished is received, play it backward
  • animation_finished is not received when the backward animation ends

Minimal reproduction project

3.x MRP: AnimatedSpriteTest-3.x.zip
master MRP: AnimatedSpriteTest-4.0.zip

There's a backwards export bool that can be toggled to observe the two behaviors described above.

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

Successfully merging a pull request may close this issue.

1 participant