Allegro GIF Animation Library
julian_boolean

If it is even possible, would it be a good idea to use this library for 2D character animations, like walking cycles, attacking, etc? Like, if you press the up arrow key, it would play the north walk cycle gif, when you let go of the key, it would replace it with a regular bitmap of the character facing north.

Bare with me, I havn't actually done anything in this area before.

kazzmir

I don't see any real benefits to using GIF's for animation other than maybe the animator only knows how to make GIFs or something, but its a simple process to extract the individual images out anyway. Basically for animation you just want to scroll through a list of images.

BITMAP * images[ 10 ];
int current_image = 0;
while ( ... ){
   draw_sprite( image[ current_image ], screeen, ... );
   if ( key[ KEY_RIGHT ] ){
     // cycle to the next image
     current_image = (current_image + 1 ) % 10;
   }
}

Or whatever.

Thomas Harte

I think the main argument in favour of animated gif is that as it is a standard file format, you can use a whole bunch of pre-existing tools. Conversely, you get stuck with 256 colour images with no proper transparency. Beyond that, it really depends on the exact nature of your game...

julian_boolean

It's just your typical 2D RPG. I thought this library might make it easier to do anything that requires animation, but that snippet looks good too.

Kikaru

I'd like support for animated GIFs also, but it's not too major. :)

ImLeftFooted

Just use some tool to extract the frames to seperate images before you import it in grabber.

Thread #591024. Printed from Allegro.cc