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

Set initial frame when animation is changed #976

Merged
merged 1 commit into from
Mar 2, 2025

Conversation

wolf81
Copy link
Contributor

@wolf81 wolf81 commented Mar 1, 2025

I wanted to have single-frame animations (just to keep the logic simple in my game). E.g. while a move state might have multiple frames, an idle state just shows a single frame.

However, I noticed in such cases the animation would not be updated. Initially, I thought I did something wrong but couldn't figure it out. Then I looked into the codebase and noticed a small issue. When an animation is set, the initial frame is not yet configured. It will only change after an update, which would only happen for multi-frame animations.

This small change ensures the initial frame is configured as soon as the animation is set. This way, the correct sprite is also immediately shown for the new animation.

Perhaps these issues are related:

Copy link
Member

@AristurtleDev AristurtleDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thansk @wolf81

@AristurtleDev AristurtleDev merged commit b8d9203 into craftworkgames:develop Mar 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants