Hey, I am currently working on a final project which I use GarkGDK to make a game, SpaceSurvival. The user controls a spaceship and is supposed to avoid asteriods that appear on the screen. My problem is displaying multiple asteriods at once.
I have a SpaceSurvival class which has a private member that is a vector of Asteriods (vector<Asteriods> MyAsteriods
so that I can keep track of how many asteriods are on the screen at once.
Then in the SpaceSurvival game class, I make instances of Asteriods:
int i = 4; // First spriteId unused
while(MyAsteriods.size() < MyAsteriodsMax)
{
Asteriods newAsteriod(i);
MyAsteriods.push_back(newAsteriod);
i++;
}
and then have each Aasteriod updated:
for(int i = 0; i < MyAsteriods.size(); i++)
{
MyAsteriods[i].Update();
}
However, my game only displays one asteriod, even though it makes all 10 (ten is the max size of the vector). Does anyone know why this would be happening? I asked my teacher and he wasn't sure either.
Attached is the constructor of my Asteriod class as well..
I'd appreciate any advice on how to fix this problem