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
fix: delayed animation start when switching to a new animation #67
Conversation
The `SpriteSheetAnimationState` `update` function doesn't always update the sprite index to match the current frame index. When changing animations, this delays update of `sprite.index` until after the first frame duration has elapsed. To fix this, always update the sprite index to match the current frame.
To verify this issue, I printed out the state of my character each frame; whenever the state is updated, I update the
You can see that even though the frame index updates to match the new animation, the sprite index is not updated until the first frame of the new animation completes. This happens regardless of whether the Compared to the behavior with the proposed change:
|
Thank you for the contribution 👍 I'd prefer a unit test, rather that a manual testing procedure. I can write one if you don't know how to or don't have time. |
I can put together a unit test tomorrow/over the weekend. Thanks for taking a look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks 👍
🎉 This issue has been resolved in version 3.6.1 🎉 |
The
SpriteSheetAnimationState
update
function doesn't always updatethe sprite index to match the current frame index. When changing
animations, this delays update of
sprite.index
until after the firstframe duration has elapsed.
To fix this, always update the sprite index to match the current frame.