void Game::DrawBullets() { static int first_action = 1; static int lastAction = 0; int spacer = 300; if ((SDL_GetTicks() >= (lastAction + spacer)) || first_action == 1) { for (double i=-2.0, j = 0.2; i<2.0; i+=0.1) { j -= (i/30); projectiles.push_back(new Projectile("bullet_small", (bossPos_x + (sprBoss->GetSurface()->w / 2)), (bossPos_y + ((sprBoss->GetSurface()->h) - 20)), i, j)); } lastAction = SDL_GetTicks(); if (first_action == 1) { first_action = 0; } } for (std::list::iterator i = projectiles.begin(); i != projectiles.end(); i++) { (*i)->returnSpr()->MoveTo((*i)->posX(), (*i)->posY()); (*i)->returnSpr()->Draw(); (*i)->move(); if ((*i)->posX() < -20 || (*i)->posY() < -20 || (*i)->posX() > (WIN_W + 20) || (*i)->posY() > (WIN_H + 20)) { delete *i; i = projectiles.erase(i); } } }