MonoGame.Extended
MonoGame.Extended copied to clipboard
AnimatedSprite displays first region of texture atlas before animation plays
Link to docs: https://www.monogameextended.net/docs/features/2d-animations/animatedsprite/
I was following the documentation but I'm seeing this issue where the first region of the atlas displays before the desired animation. In my code I've defined a sleep animation that does play, but before it plays the first region of the texture atlas (atlas) displays before.
@AristurtleDev: "The problem is how the AnimatedSprite(SpriteSheet, String) constructor is done when you call it by doing _dog = new AnimatedSprite(_spriteSheet, "sleep").
That constructor takes the _spriteSheet and calls the other constructor to set that up. Since AnimatedSprite is derived from Sprite, then it has to call the base constructor and pass in a texture to use, which just defaults to the first index in the texture atlas.
For right now, you should be able to fix this by instead doing the following workaround until a fix is pushed"
_dog = new AnimatedSprite(_spriteSheet);
_dog.SetAnimation("sleep");