Beispiel #1
0
void AIManager::calculateNextMoveSimple() {
	Paddle* leftPlayer = mWorld->getLeftPlayer();
	Wall* bottomWall = mWorld->getBottomWall();
	Wall* topWall = mWorld->getTopWall();
	if (leftPlayer->hitVerticallyWith(bottomWall)) {
		leftPlayer->setDirection(PADDLE_DIRECTION_UP);
	} 
	if (leftPlayer->hitVerticallyWith(topWall)) {
		leftPlayer->setDirection(PADDLE_DIRECTION_DOWN);
	}
	if (leftPlayer->getDirection() == PADDLE_DIRECTION_DOWN) {
		mNextMove = MOVE_DOWN;
	} else {
		mNextMove = MOVE_UP;
	}
}
Beispiel #2
0
bool WorldManager::isLeftPlayerHitTopWall() {
	Paddle *leftPlayer = mWorld->getLeftPlayer();
	Wall *topWall = mWorld->getTopWall();
	return leftPlayer->hitVerticallyWith(topWall);
}
Beispiel #3
0
bool WorldManager::isRightPlayerHitBottomWall() {
	Paddle *rightPlayer = mWorld->getRightPlayer();
	Wall *bottomWall = mWorld->getBottomWall();
	return rightPlayer->hitVerticallyWith(bottomWall);
}
Beispiel #4
0
bool WorldManager::isRightPlayerHitTopWall() {
	Paddle *rightPlayer = mWorld->getRightPlayer();
	Wall *topWall = mWorld->getTopWall();
	return rightPlayer->hitVerticallyWith(topWall);
}
Beispiel #5
0
bool WorldManager::isLeftPlayerHitBottomWall() {
	Paddle *leftPlayer = mWorld->getLeftPlayer();
	Wall *bottomWall = mWorld->getBottomWall();
	return leftPlayer->hitVerticallyWith(bottomWall);
}