Okay as of right now my contact listener tells me when certain game objects collide like so:
So Basically I am checking specific user data that I designated when I create my classes. So essentially I would have to put a bunch of if statements in order to know if my character is colliding with certain objects. So I guess my question is, is there a better way to check a bunch of different object without creating a bunch of if statements. Also how would I go about deleting an object, I read through some of the documentation and it said the contact listener cant delete objects.
Code:
void ContactListener::Add(const b2ContactPoint *point)
{
if(point->shape1->GetBody()->GetUserData() == "Character" && point->shape2->GetBody()->GetUserData() == "Element")
{
//////Do stuff//////////
}
}
{
if(point->shape1->GetBody()->GetUserData() == "Character" && point->shape2->GetBody()->GetUserData() == "Element")
{
//////Do stuff//////////
}
}
So Basically I am checking specific user data that I designated when I create my classes. So essentially I would have to put a bunch of if statements in order to know if my character is colliding with certain objects. So I guess my question is, is there a better way to check a bunch of different object without creating a bunch of if statements. Also how would I go about deleting an object, I read through some of the documentation and it said the contact listener cant delete objects.