I'm building Breakout for a project. I'm nearly done but I have one issue, deleting the bricks from the vector when they have taken enough hits. This is the function I'm currently working with:
void HandleBlockCollision()
{
for (auto &p : enemies)
{
p.hits--;
if (p.hits == 0)
{
enemies.erase;
}
}
}
The error I'm getting is:
Error 1 error C2664: 'std::_Vector_iterator>> std::vector>::erase(std::_Vector_const_iterator>>,std::_Vector_const_iterator>>)' : cannot convert argument 1 from 'SDL_Rect' to 'std::_Vector_const_iterator>>'
I'm not sure what's going wrong.
Cheers!