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

Recommended pattern for resetting to index 0 on pause? #6

Closed
thedodd opened this issue Jul 22, 2021 · 2 comments · Fixed by #8
Closed

Recommended pattern for resetting to index 0 on pause? #6

thedodd opened this issue Jul 22, 2021 · 2 comments · Fixed by #8
Labels
enhancement New feature or request

Comments

@thedodd
Copy link
Contributor

thedodd commented Jul 22, 2021

In the case where the Play component is remove to pause the animation, I would like to reset the sprite index to 0 (an idle "looking" state). Manually update the Frame?

Also, thanks for the great library!

@thedodd
Copy link
Contributor Author

thedodd commented Jul 22, 2021

Update: looks like the pattern that works is to update the TextureAtlasSprite component of the entity, manually setting its index back to 0 when the Play component is removed.

@jcornaz jcornaz added the enhancement New feature or request label Jul 22, 2021
@jcornaz
Copy link
Owner

jcornaz commented Jul 22, 2021

Yes. I think benimator should expose the animation state component with a pub fn reset(&mut self) method.

Update: looks like the pattern that works is to update the TextureAtlasSprite component of the entity, manually setting its index back to 0 when the Play component is removed.

Mmh. Maybe. I'm kind of surprised that it works actually. I'll investiguate how it behaves (or should behave) in this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants