Hello,
I am trying to add my bullet struct into a vector of bullets. So I can shoot multiple bullets. However I get a subscript out of range when I try to run the program. I can't figure out why its not adding the bullets to the vector.
BULLET Bullet;
vector <BULLET> Bullets;
if (IsKeyPressed(KEY_SPACE)) //add bullets to the vector
{
Bullet.Visible = true;
Bullets.push_back(Bullet);
}
if (Bullet.Visible) //shooting the bullet(s)
{
for (int i = 0; i <= Bullets.size(); i++)
{
DrawCircleV(Bullets[i].Pos, Bullets[i].Rad, RED);
}
}