I'm try to make a simple game but I dont know very well the algorithm about detect the collsion among my object with multiple object and stop it from moving if I hit(collison) one of those . here my code :
for(std::vector<Entity*>::size_type i = 1 ; i != entityarray.size() ; i++)
{
if(myEntity->getX() + myEntity->getWidth() > entityarray[i]->getX())
{
myEntity->rightisBlocked = true;
}
else
{
myEntity->rightisBlocked = false;
}
}
the point is how can I aplly for multiple surface it would hit other like : up , left , down , because I can't move pass the obstacle(X pose )
Aucun commentaire:
Enregistrer un commentaire