Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro GIF Animation Library

This thread is locked; no one can reply to it. rss feed Print
Allegro GIF Animation Library
julian_boolean
Member #8,201
January 2007

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
Member #1,786
December 2001
avatar

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
Member #33
April 2000
avatar

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
Member #8,201
January 2007

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
Member #7,616
August 2006
avatar

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

Dustin Dettmer
Member #3,935
October 2003
avatar

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

Go to: