Archived

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

Daboy

Game Questions

Recommended Posts

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
hmmm ok i guess im not getting this hope im not putting u through alot but in short i want it so if u click a button it will flip through 3 images or so is there a simple code for that???

Share this post


Link to post
Share on other sites