Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Correct Lower Paddle Collision
When colliding with the lower wall the paddle would incorrectly go to far before stopping. This fixes the order of operations to correct when the paddle stops
  • Loading branch information
ShadowLordAlpha authored Nov 21, 2024
commit cd97e8432e4c802cf642da3f98bbc3c8fdc0805a
4 changes: 2 additions & 2 deletions Chapter01/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down