I have a vector of class objects (bullets) and it works for the most part. But as soon as I try to delete the bullets it loops back and then causes a breakpoint. "basic game.exe has triggered a breakpoint." I have tried iterating backwards and forwards, but it always gets stuck.
I'm using SFML, and the objects are rectangle with positions, rotations and sizes.
for (it = bullets.end(); it != bullets.begin(); it--)
{
it->draw(game);
it->move();
if (it->bullet.getPosition().x > 800)
{
bullets.erase(it);
}
}
I'm a noob at coding, so if you need other infomation ill try and provide it.