diff --git a/Chapter01/Game.cpp b/Chapter01/Game.cpp index 3b18199e..8a210cda 100644 --- a/Chapter01/Game.cpp +++ b/Chapter01/Game.cpp @@ -141,9 +141,9 @@ void Game::UpdateGame() { mPaddlePos.y = paddleH/2.0f + thickness; } - else if (mPaddlePos.y > (768.0f - paddleH/2.0f - thickness)) + else if (mPaddlePos.y > (768.0f - (paddleH/2.0f - thickness))) { - mPaddlePos.y = 768.0f - paddleH/2.0f - thickness; + mPaddlePos.y = 768.0f - (paddleH/2.0f - thickness); } } @@ -160,7 +160,7 @@ void Game::UpdateGame() // Our y-difference is small enough diff <= paddleH / 2.0f && // We are in the correct x-position - mBallPos.x <= 25.0f && mBallPos.x >= 20.0f && + mBallPos.x <= 30.0f && mBallPos.x >= 25.0f && // The ball is moving to the left mBallVel.x < 0.0f) { @@ -172,18 +172,18 @@ void Game::UpdateGame() mIsRunning = false; } // Did the ball collide with the right wall? - else if (mBallPos.x >= (1024.0f - thickness) && mBallVel.x > 0.0f) + else if (mBallPos.x >= (1024.0f - thickness * 1.5) && mBallVel.x > 0.0f) { mBallVel.x *= -1.0f; } // Did the ball collide with the top wall? - if (mBallPos.y <= thickness && mBallVel.y < 0.0f) + if (mBallPos.y <= thickness * 1.5 && mBallVel.y < 0.0f) { mBallVel.y *= -1; } // Did the ball collide with the bottom wall? - else if (mBallPos.y >= (768 - thickness) && + else if (mBallPos.y >= (768 - thickness * 1.5) && mBallVel.y > 0.0f) { mBallVel.y *= -1;