Hello
I have ran into a problem while programming my game. First of all, it is a 2D game in which I am using the Dark GDK. My problem lies with unique ID values for different images that are created in the program. I created a list that handles my objects (I remove and add as needed) but I'm not sure how to go about giving each object its own Dark GDK sprite ID (especially since I will eventually delete each object).
Here is an example of my list to get you an idea of what I'm working with:
//----------------- Laser List Creation -----------------
std::list<CLaser> lLaser;
//----------------- Laser Handling -----------------
for (std::list<CLaser>::iterator i = lLaser.begin(); i != lLaser.end(); i++) {
i->updateLaser();
}
//----------------- Laser creation -----------------
if (laserTimer1 <= clock()) {
CLaser x;
lLaser.push_front(x);
laserTimer1 = clock() + ( rand() % 10 + 1 ) * CLOCKS_PER_SEC;
}
// Draw the image
dbSprite(25,lasX,lasY,25);
dbSetSpritePriority(25,1);
Just so it is known, this isn't exactly how I have my code set up but you should get the idea of what I'm working with. Anyway, as you can see I currently have every sprite set with the ID of 25 which results in only one laser being on screen at once.
How should I manage the sprite ID's along with my list of objects?