Game Questions
Hey, im making a little game that involves a cannon witch u can lower and raise and fire....and i made picture of it at different heights and different stages of fire... I figured out how to make it switch from higher to lower but how can i link several images in a row??? plz respond if u know how...Thanks
Create a Class or structure that includes a pointer to the same data type (Linked List) or create an array of the Surfaces/class/structure and loop through them based on how many frames passed or some other time function.
''G,Luck!
''G,Luck!
Simple example of a class (**NOTE** a lot left out for focus on the linked list of it )
CSprite
{
CSprite();
~CSprite();
public:
CSprite* GetNext() { return m_pNext; };
void SetNext( CSprite pSprite ) { m_pNext = pSprite; };
private:
CSprite* m_pNext;
LPDIRECT3DTEXTURE8 m_pSurface;
};
What you would do is - you could either load each image into a CSprite variable. Set the next image via the SetNext and when you''re looping through to render the image use GetNext up until you get a NULL value ( set m_pNext to null in the constructor ) then start over or you could even template the images into one bitmap, have each the same size and then extract the image per frame. Too much to explain here in a responce thread .. best bet is to look in the Articles section on this site.
''G,Luck again!
CSprite
{
CSprite();
~CSprite();
public:
CSprite* GetNext() { return m_pNext; };
void SetNext( CSprite pSprite ) { m_pNext = pSprite; };
private:
CSprite* m_pNext;
LPDIRECT3DTEXTURE8 m_pSurface;
};
What you would do is - you could either load each image into a CSprite variable. Set the next image via the SetNext and when you''re looping through to render the image use GetNext up until you get a NULL value ( set m_pNext to null in the constructor ) then start over or you could even template the images into one bitmap, have each the same size and then extract the image per frame. Too much to explain here in a responce thread .. best bet is to look in the Articles section on this site.
''G,Luck again!
Also assuming you''re using DirectX8 ( The LPDIRECT3DTEXTURE8 variable ... if not just have an array for the bitmap/image that you want to load up )
''G,Luck
''G,Luck
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement