CollisionDirection CollisionHandler::DetectCollisionWithObj(MovingObject& _obj, DisplayableObject& _ref) { if (_obj.GetID() == _ref.GetID()) return NO_COL; return DetectCollisionWithRect(_obj.GetCoordinates(), _ref.GetCoordinates()); }
void CollisionHandler::HandleCollisionsWithMapEdges(MovingObject& _obj) { if (_obj.GetPosition().x < 0) { _obj.UpdateAfterCollisionWithMapEdge(CollisionDirection::LEFT, _obj.GetPosition().x); } float gapRightEdge = _obj.GetPosition().x - (m_levelSize.x - _obj.GetCoordinates().width); if (gapRightEdge > 0) { _obj.UpdateAfterCollisionWithMapEdge(CollisionDirection::RIGHT, gapRightEdge); } if (_obj.GetPosition().y > m_levelSize.y) _obj.Kill(); }