animation how???
ok, I need to know how to do simple animation. I have all my images in separate surfaces and would like to bltfast them as the guy moves in different directions. I had it like this:
if(vk_key_left)
{
originalsprite++;
bltfast(the bitmap of guy facing left)
}
it didn''t work.
I need it as simple as possible please. Try to avoid structs and stuff like that. I don''t really care about speed at the moment either. Thanks.
You could do it like this:
#define NUM_FRAMES 3
#define FRAME_IDLE 0
#define FRAME_MOVE_LEFT 1
#define FRAME_MOVE_RIGHT 2
IDirectDrawSurface7 *pSurfaces[NUM_FRAMES];
int CurrentFrame = FRAME_IDLE;
if( vk_key_left )
CurrentFrame = FRAME_MOVE_LEFT;
if( vk_key_right )
CurrentFrame = FRAME_MOVE_RIGHT;
BltFast(CurrentFrame);
Of course there is not much animation going on here, your character just changes its appearance according to its direction.
- WitchLord
#define NUM_FRAMES 3
#define FRAME_IDLE 0
#define FRAME_MOVE_LEFT 1
#define FRAME_MOVE_RIGHT 2
IDirectDrawSurface7 *pSurfaces[NUM_FRAMES];
int CurrentFrame = FRAME_IDLE;
if( vk_key_left )
CurrentFrame = FRAME_MOVE_LEFT;
if( vk_key_right )
CurrentFrame = FRAME_MOVE_RIGHT;
BltFast(CurrentFrame);
Of course there is not much animation going on here, your character just changes its appearance according to its direction.
- WitchLord
I just use:
pDirDraw->BlitToBack(&CPoint(xdes,ydes), frame++>maxFrames?frame=0,&CRect(0,frame<<5,32,(frame<<5)+32));
pDirDraw->BlitToBack(&CPoint(xdes,ydes), frame++>maxFrames?frame=0,&CRect(0,frame<<5,32,(frame<<5)+32));
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement