From d00e96c991551747bddd572792b4c21db61cc733 Mon Sep 17 00:00:00 2001 From: Mike Sharp Date: Mon, 19 Aug 2024 13:49:05 +0100 Subject: [PATCH] fix: be sure to centre the paddle on click and motion --- Game/src/States/RandomRebound_GameState.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Game/src/States/RandomRebound_GameState.cpp b/Game/src/States/RandomRebound_GameState.cpp index 35f55d8..68b6dd6 100755 --- a/Game/src/States/RandomRebound_GameState.cpp +++ b/Game/src/States/RandomRebound_GameState.cpp @@ -77,7 +77,7 @@ void RandomRebound_GameState::CheckEvent() } else if (e->type == SDL_MOUSEMOTION) { - m_player->SetPosition((m_cursorBounds->X()), m_player->Bounds().Y()); + m_player->SetPosition((m_cursorBounds->X()- m_player->Bounds().Width()/2), m_player->Bounds().Y()); } else if (e->type == SDL_MOUSEBUTTONDOWN) { @@ -125,7 +125,7 @@ void RandomRebound_GameState::UpdateLogic() { if (m_mouseButtonPressedState == true) { - m_player->SetPosition((m_cursorBounds->X()), m_player->Bounds().Y()); + m_player->SetPosition((m_cursorBounds->X()- m_player->Bounds().Width()/2), m_player->Bounds().Y()); } if (m_leftKeyState && m_player->Bounds().X() - m_player->XSpeed() > m_minPaddleX) {