Hi ! I've a std::map<std::string,Obj*> which contains an ObjA, an ObjB and many ObjC.
I made a function which manages collision between ObjB and ObjC (it works) !
but my function which is used for delete my ObjC when they collide with my ObjB didn't :
//ManagerObj.cpp
void ManagerObj::deleteObj(std::map<std::string, Blocks*>::iterator i)
{
m_VecMap.erase(i);
}
void ManagerObj::updateAll()
{
for (std::map<std::string, Obj*>::iterator i = m_VecMap.begin(); i != m_VecMap.end(); ++i)
{
if ((i->first == "ObjC") && (i->second->checkCollision() == true)) delete(i);
i->second->update(); // used for ObjB and ObjC collide and they do
}
}
//main.cpp
ManagerObj mapManager;
mapManager.addObj("ObjA", p_ObjA);
mapManager.addObj("ObjB", p_ObjB);
mapManager.addObj("ObjC", p_ObjC);
//...
mapManager.updateAll();
//...
Can you help me to erase my ObjC from mapManager when it collides with ObjB ? Thanks you !