Jump to content
  • Advertisement

Archived

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

F_r_e_s_h

Sprite sequences

This topic is 6173 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

Ive recently started to write a modest size stratergie game ani think i have got a majority of the graphics, input and sound engine all working okay. But ive sorta come to a problem. How would you deffine different sequences for sprites etc running, shottin or just idle? Like i know how to do it hard coded into the program but i want to make it so i can change all this sort of stuff from a a data file. Sorry im not very good at explaining what i mean but basically im asking how you would tell the program from a data file that when the sprite is going left to play frames 3 through to 8 or something like that. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Create a struct with the frame information, then write the struct to your data file.

For example:

#define MAX_ACTIONS 16
#define MAX_FRAMES 16

#define ACTION_IDLE 0
#define ACTION_WALK 1
#define etc...

typedef struct SPRITE
{
char szBitmap[MAX_PATH];
WORD numActions[MAX_ACTIONS];
WORD numFramesPerAction[MAX_ACTIONS][MAX_FRAMES];
POINT ptActionOffset[MAX_ACTIONS][MAX_FRAMES];
}

Edited by - Anarchi on September 25, 2001 11:25:13 PM

Share this post


Link to post
Share on other sites
A simple method I picked up from Andre LaMothe''s Teach Yourself Game Programming in 21 Days (gee, that was 5/6 years ago!) is to decide what size you want your sprites to be and then create a grid of "cells" in a bitmap file. In each cell have a frame of animation which can be changed independently of the program code.

Say you were creating a tank game, where you don''t really have animated sprites - you just need the sprite pointed in different directions. Create the images of the sprite facing north, north-northeast, northeast, east-northeast, east, etc and put them in the individual cells (btw that will result in 16 sprites).

You''ll need to write functions to load the bitmap file and to extract the individual cells, but that''s not too hard once you understand fundamental concepts.

Hope that helped.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!