gifs and character animation

Hi people, i`m having some problems with gifs using monogame, i have some gifs of a top down RPG character, but, whe i import using the Content, it appears a error message telling that it could not import properly the gif, anyone know if its possible to load gifs? btw, how animations are made? My first thougths were gifs, but, there’s another way to do it?

1 Like

I don’t think MonoGame imports gifs by default. While that would be a really cool feature, it’s my understanding that they are trying to faithfully recreate the XNA API, which also didn’t include this.

I bet if you dug around the internet you could find a library for importing gifs, as well as automatically playing them as a sprite. You might have to port it over to C# though :smiley:

Anyway, the usual approach is to set up sprite sheets, which you can probably easily set up from a gif yourself. The idea is to just display each frame on your own with a SpriteBatch.Draw call, at the appropriate rate you decide. How you slice up your sprite sheets and decide to integrate those portions with your draw calls is entirely up to you, though I think most folks either slice them up into separate textures, or just use rectangle regions and use the appropriate SpriteBatch.Draw overload to draw that portion of the sprite sheet.

Hope that helped… good luck! :slight_smile:

1 Like