jcornaz/benimator

Recommended pattern for resetting to index 0 on pause?

thedodd opened this issue · 2 comments

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!

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.

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.