1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

Pong: Fix paddle movement across resets if keys are held

The game waited for the next key down event before moving the player
paddle. Now the state of the arrow keys is carried over between resets.
This commit is contained in:
Dmitrii Ubskii 2021-05-16 23:47:10 +03:00 committed by Linus Groh
parent 58131082f4
commit 9a7aac1c6a

View file

@ -23,8 +23,8 @@ void Game::reset_paddles()
{
m_cursor_paddle_target_y.clear();
m_player1_paddle.moving_up = false;
m_player1_paddle.moving_down = false;
m_player1_paddle.moving_up = m_up_key_held;
m_player1_paddle.moving_down = m_down_key_held;
m_player1_paddle.rect = { game_width - 12, game_height / 2 - 40, m_player1_paddle.width, m_player1_paddle.height };
m_player2_paddle.moving_up = false;