Skip to content

Commit

Permalink
fix: be sure to centre the paddle on click and motion
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedsharp committed Aug 19, 2024
1 parent 47b8ebe commit d00e96c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Game/src/States/RandomRebound_GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit d00e96c

Please sign in to comment.