Game Questions

Started by
7 comments, last by Daboy 22 years, 5 months ago
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
Jordan Weberwww.pheonixsoftware.com
Advertisement
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!
Hey....im kinda new can u help me on that plz????thx man
Jordan Weberwww.pheonixsoftware.com
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!
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
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???
Jordan Weberwww.pheonixsoftware.com
i dont know if i said this but im using delphi...is that c++??
Jordan Weberwww.pheonixsoftware.com
C++ .. don''t know delphi sorry
Oh ok...thx for the help tho u seem to know alot about c++
Jordan Weberwww.pheonixsoftware.com

This topic is closed to new replies.

Advertisement