Loading Frames with BOB engine
I am trying to load frames for an animation with the game engine from "Windows Game Programming For Dummies."
I have two sprites, two cells in each sprite.
Here is how I define them:
///////////////////////////////
BOB frog;
int frog_anims[2][2] = { { 0,1 },{ 2,3 } };
//////////////////////////////
The names of the bitmaps are "FROG0.bmp" and "FROG1.BMP"
Here is how I am loading them:
///////////////////////////////
Create_BOB(&frog, 0,0,153,147, 4,
BOB_ATTR_VISIBLE / BOB_ATTR_MULTI_ANIM,
DDSCAPS_SYSTEMMEMORY);
for (int direction=0; direction < 1; direction++)
{
sprintf(filename, "frog%d.BMP",direction);
Load_Bitmap_File(&bitmap8bit, filename);
Set_Palette(bitmap8bit.palette);
Load_Frame_BOB(&frog,&bitmap8bit,0+direction*4,0,0,BITMAP_EXTRACT_MODE_CELL);
Load_Frame_BOB(&frog,&bitmap8bit,1+direction*4,1,0,BITMAP_EXTRACT_MODE_CELL);
Unload_Bitmap_File(&bitmap8bit);
Load_Animation_BOB(&frog,direction,2,frog_anims[direction]);
} // end for direction
Set_Animation_BOB(&frog,0);
Set_Pos_BOB(&frog,240,140);
Set_Vel_BOB(&frog,0,0);
Set_Anim_Speed_BOB(&frog,7);
Unload_Bitmap_File(&bitmap8bit);
///////////////////////////////
I am not sure if I am doing this correctly because the sprites are loading on top of eachother and it looks HORRIBLE!
Thanks!
-Alex
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement