From 5f181f45e0eb3a0b271c45d45f639395672862f7 Mon Sep 17 00:00:00 2001 From: Joseph Aquino Date: Wed, 24 Sep 2025 17:26:22 -0400 Subject: [PATCH] minor update --- src/Game.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index 2a8b2b8..118b20f 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -233,8 +233,8 @@ void Game::collision() checkBallCollision(); - const sf:: FloatRect playerBounds = {player.pos, playerHalfSize}; //player wall collide + const sf:: FloatRect playerBounds = {player.pos, playerHalfSize}; if (playerBounds.position.x + playerBounds.size.x > window.getSize().x) { player.pos.x = window.getSize().x - playerHalfSize.x; @@ -371,11 +371,11 @@ void Game::checkBallCollision() { ball.velocity.x *= -1; if (ball.pos.x < player.pos.x) - { + {// from the left ball.pos.x -= intersect.x; } else - { + {// from the right ball.pos.x += intersect.x; } } @@ -385,11 +385,11 @@ void Game::checkBallCollision() { ball.velocity.y *= -1; if (ball.pos.y < player.pos.y) - { + {// from the top ball.pos.y -= intersect.y; } - else - { + else if (ball.pos.y > player.pos.y) + {// from the bottom ball.pos.y += intersect.y; } }