Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

arwez

animation how???

This topic is 6912 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
I just use:

pDirDraw->BlitToBack(&CPoint(xdes,ydes), frame++>maxFrames?frame=0,&CRect(0,frame<<5,32,(frame<<5)+32));

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!