bool Game::isOverlap(Entity *entity0, Entity *entity1){ const VGCVector position0 = entity0->getPosition(); const int X0 = position0.getX(); const int Y0 = position0.getY(); const int R0 = entity0->getRadius(); const VGCVector position1 = entity1->getPosition(); const int X1 = position1.getX(); const int Y1 = position1.getY(); const int R1 = entity1->getRadius(); const int DX = X0 - X1; const int DY = Y0 - Y1; return DX * DX + DY * DY < (R0 + R1) * (R0 + R1); }
bool Game::isOverlap(Entity *entity0, Entity *entity1) { //Collision using pythagoras theorem const VGCVector position0 = entity0->getPosition(); const int X0 = position0.getX(); const int Y0 = position0.getY(); const int R0 = entity0->getRadius(); const VGCVector position1 = entity1->getPosition(); const int X1 = position1.getX(); const int Y1 = position1.getY(); const int R1 = entity1->getRadius(); const int DX = X0 - X1; const int DY = Y0 - Y1; return (DX * DX) + (DY * DY) < (R0 + R1) * (R0 + R1); }