From: tjaden AT desky DOT localdomain () Newsgroups: comp.os.msdos.djgpp Subject: Re: Please help - Allegro/Sprites Question. References: <38C28D93 DOT 1457A457 AT hotmail DOT com> Message-ID: User-Agent: slrn/0.9.5.4 (UNIX) NNTP-Posting-Host: d04-as22-mel.alphalink.com.au Date: 6 Mar 2000 23:23:54 GMT X-Trace: 6 Mar 2000 23:23:54 GMT, d04-as22-mel.alphalink.com.au Lines: 32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Dan Nicoletti wrote: > >void sprite_init() >{ >blit(file[0].dat,sprite[0]->bitmap,0,0,0,0,16,16); >blit(file[1].dat,sprite[1]->bitmap,0,0,0,0,16,16); >etc. >} > >Problem: For some reason the second blit overwrites the >first one and I end up with the same sprite for each. You need to allocate some memory for the sprites first: sprite[0]->bitmap = create_bitmap(16, 16); I would probably use a function like: BITMAP *clone_bitmap(BITMAP *src) { BITMAP *b; b = create_bitmap_ex(bitmap_color_depth(src), src->w, src->h); if (b) blit(src, b, 0, 0, 0, 0, src->w, src->h); return b; } But you might as well use the graphics straight from the datafile structure. sprite[0]->bitmap = file[0].dat; Peter