Skip to main content
gamedev.net
🔒 Locked

Comments on Sprite Lists

Started by ZoomBoy 0 replies 300+ views
Original Post
ZoomBoy
ZoomBoy
I''m working on a sprite editor and trying to sort out how to handle lists of sprites. A lot of this working it out as I go. In the game Sprites will be loaded once to a different surface for each list. class SpriteData { public: .... unsigned short int* PixelData; LPDIRECTDRAWSURFACE pGameSource; RECT BlitSource; Sprite(); ~Sprite(); void GrabSpriteFromEditGrid(); void PaintSprite(); void PlaceOnSurface(); } Thr trickier part comes when it comes to making different types of sprite-lists. They''re will be two different basic types: 1D array of static objects that might break or explode or be special FX but are only seen from one angle 2D array of moving objects that have different facings(I''ll be using 4 directions) class SpriteList { int nListType; int nTotalFrames; int nFacings; // Zero for Static; 4 currently for Moving char szListName[30]; SpriteData *pSpriteArray; // new [nTotalFrames] or new [nTotalFrames][nFacings] SpriteData int *pCutLines; SpriteList(int ListType); ~SpriteList(); void ProcessPanelArea(int mousex, int mousey); void CreateListSurface(LPDIRECTDRAWSURFACE pGameSource); void NextSprite(); } My first impulse had been to have a switch statement SPRITELISTTYPE_STATIC SPRITELISTTYPE_STATICADV SPRITELISTTYPE_STATIC_FX SPRITELISTTYPE_MOVINGBASICCHAR // SPRITELISTTYPE_MOVINGFULLCHAR But then I''d thought I''d derive from a base class into the two types class SprStaticList : class SpriteList { SprStaticList(int nFrames); void ProcessPanelArea(int mousex, int mousey); void CreateListSurface(LPDIRECTDRAWSURFACE pGameSource); void NextSprite(); }; So the upshot is I''ll have to virtualize the functions in SpriteList and create versions for each type(static & moving) Therefore my Player, Enemy, and Static Objects should be holding the data on direction(facing) and the current frame #. And the AI has to have a set of frame numbers that go with each AI activity. The basic(NPC) char would have a different(shorter) set of entry points for frame #s. I might put all the static objects onto one surface. I did this mainly to sort it out for myself. Comments are appreciated though. ZoomBoy Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.