Archived

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

bdc256

SPRITE MANAGER

Recommended Posts

does any one know where a can find a sprite mamanagment system preferably open source i have been working on my own for about a mounth not to good but i think it''s good to try any why good practice just in case your woundering it is based around this idea struct sprite {RECT rectposition; sprite_stats stats; //this changes every game depending on what // you need such as hp,power ect... sprite_state state;//same as above but for witch stat it is in //these would be such as patrol, shearch, attack, retreat rval (*update)(/*data about game/sprite); //called to update // sprite like making it move void (*draw)(); }; any ideas comments would be aperated

Share this post


Link to post
Share on other sites
I think you should turn your sprite system into a class rather than a struct, and confine the actual graphics aspects to that class. You could then add child classes like a static sprite, an npc sprite, and the character sprite. I think it would be easier in the long run to do it this way.

Share this post


Link to post
Share on other sites
it is a class i just put a simplified version down becuase i was not sure how the final version of my sprite class would look but it would countain that data

a second question
should i use a function pointer or callback

a third question
how do you create a callback

Share this post


Link to post
Share on other sites
I'm not so sure that anyone knows what you are talking about.

What do you want a sprite management system to do? The way you seem to be going about this looks a lot harder than simply having a Sprite class that handles drawing itself.

EDIT: I see that you are using function pointers in your struct. Call me crazy, but I never use function pointers when simpler solutions are evident. Why would you use them in this situation?

Sorry if I'm unhelpful, but I'm really confused as to what you are trying to do here.




Things are not what they are.


[edited by - myme15 on June 10, 2002 2:17:10 PM]

Share this post


Link to post
Share on other sites