示例#1
0
bool RobotClass::detectObstacle(Obstacle obstacle)
{	
	int xdiff = getXPosition() - obstacle.getXPosition(); 
	int ydiff = getYPosition() - obstacle.getYPosition();
	int distance = getSize() + obstacle.getSize();
	if (xdiff * xdiff + ydiff * ydiff <= distance * distance)
	{
		return true;
	}
	else return false;
}