I'm trying to erase bullets if bullets are out of window. There is a code where i want to do this:
for (size_t i = 0; i < bullets.size();i++)
{
if (bullets[i]->bullet.getPosition().y < window.getPosition().y)
{
bullets.erase(bullets.begin()+i);
std::cout << "USUNIETO KULE" << std::endl;
}
bullets[i]->bullet_draw(window);
bullets[i]->bullet_shooting();
}
Thanks for help.