Using Gifs for sprites
Blitz3D Forums/Blitz3D Beginners Area/Using Gifs for sprites
| ||
Hi there. I am using the code from the code archives that "loads" an animated gif file then returns a variable called "animpic" (i think thats what its called!). My question is - is the "animpic" a picture from which i need to grab sprites (if so how) or, how do I go about getting the frames so that my sprite will animate correctly? Any advice would be appreciated. |
| ||
Check teh command refrence for the LoadAnimImage command |
| ||
Create your sprites/images/tiles of an equal size. Make another image the length and height times by how many you want in you sprite bank. E.g say your seperate images are 32 x 32, and you wanted to store and use 20 sprites. Either have them as a strip 20x32=width, and height=32 will give you 20 equal spaces to put the gfx in. Or you could have them in a grid, ie 5 across by 4 down (5x32 = width, 4x32 = height). Just times the amount you want across and down by the size of the tile. (syntax: LoadAnimImage("filename.extension",width_of_tile,height_of_tile,start(usually 0 - the first tile,how_many_tiles) Now call them in blitz using your dimensions Global graphics_bank=LoadAnimImage("graphics.gif",32,32,0,20) ;and use DrawImage graphics,pos_x,pos_y,tile_number Hope this helps you |