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; } }
bool WorldManager::isLeftPlayerHitTopWall() { Paddle *leftPlayer = mWorld->getLeftPlayer(); Wall *topWall = mWorld->getTopWall(); return leftPlayer->hitVerticallyWith(topWall); }
bool WorldManager::isRightPlayerHitBottomWall() { Paddle *rightPlayer = mWorld->getRightPlayer(); Wall *bottomWall = mWorld->getBottomWall(); return rightPlayer->hitVerticallyWith(bottomWall); }
bool WorldManager::isRightPlayerHitTopWall() { Paddle *rightPlayer = mWorld->getRightPlayer(); Wall *topWall = mWorld->getTopWall(); return rightPlayer->hitVerticallyWith(topWall); }
bool WorldManager::isLeftPlayerHitBottomWall() { Paddle *leftPlayer = mWorld->getLeftPlayer(); Wall *bottomWall = mWorld->getBottomWall(); return leftPlayer->hitVerticallyWith(bottomWall); }