You could also use linked lists for both asteroids and bullets, same as stl containers.You add an element to the list every time you want to (have an new bullet or an new asteroid)
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
{
while(acumulator > interval) //i test so that you cannot shoot many bullets per second
{
sf::Vector2f f=this->getPozitie();//get the position of the player
f.x+=this->dimensiune.x-3;//place the 'bullet position' in front of the player, f is an empty variable
f.y+=this->dimensiune.y/2-3;
this->Arma.fuel(f);//this command adds one bullet to the list
acumulator5-=intervall;
}
}
and this is the code for adding an new element
p=new glont;//the type of struct of the list
p->sprite.setTexture(texture);//texture
p->pozitie=poz;//position
p->sprite.setPosition(p->pozitie);//set the position also to the sprite
q->next=p;//setting the last bullet reference to this one
and the code for the struct
struct glont{
sf::Sprite sprite;
sf::Vector2f pozitie;
glont *next=NULL;
};
i used lists, but stl containers are much more easy and 'bug preventive' to use