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:
parent
58131082f4
commit
9a7aac1c6a
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue