Oh ok, that's what I was thinking, I just haven't used vectors in a while. Thanks!
But how do I delete a sprite? In my game, when you crash into an asteroid, your ship goes away.
Also, how would I add to my vector?
sf::Image asteroid;
asteroid.LoadFromFile("ball.png");
std::vector<sf::Sprite> asteroidV;
for(int i=0; i<5; i++)
{
asteroidV.push_back(
}
What would I put in the push_back argument? The argument makes a copy of whatever I give it, so do I put an sf::Sprite?
Edit: Never mind, I got it to work
sf::Image asteroid;
asteroid.LoadFromFile("ball.png");
sf::Sprite spriteAsteroid;
spriteAsteroid.SetImage(asteroid);
spriteAsteroid.SetPosition((float)sf::Randomizer::Random(50, 780), (float)sf::Randomizer::Random(-5, -50));
spriteAsteroid.SetCenter(spriteAsteroid.GetSize().x/2, spriteAsteroid.GetSize().y/2);
std::vector<sf::Sprite> asteroidV;
for(int i=0; i<5; i++)
{
asteroidV.push_back(spriteAsteroid);
}
But still, how do i delete a sprite?