How to init Sprite Object array

Aug 1, 2013 at 6:20pm
Hi guyz I wanted to know how to initialize an array of the following object:

helmhorr = new CSprite(csdl_setup->GetRenderer(), "Enemy00.tga", 550, 250, 100, 100, 50000, 0);

how would I go about initializing an array of such a sprite object...

int helmhorArray[6] = { helmhorr }; wont work as int is not the type of CSprite...

how would you write the init line for the array?

Thanks guyz
Aug 1, 2013 at 8:17pm
You would want to make an array of pointers to CSprites:
1
2
3
4
5
CSprite* helmhorArray[6];
for(int i = 0; i < 6; ++i)
{
   helmhorArray[i] = new CSprite(csdl_setup->GetRenderer(), "Enemy00.tga", 550, 250, 100, 100, 50000, 0);
}
Aug 1, 2013 at 9:02pm
Thank you So Much it works!!!! Wouhou I can spawn my enemies in my game!!!
Topic archived. No new replies allowed.