mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 15:32:22 +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
Notes:
sideshowbarker
2024-07-18 17:49:30 +09:00
Author: https://github.com/dmitrii-ubskii
Commit: 9a7aac1c6a
Pull-request: https://github.com/SerenityOS/serenity/pull/7196
Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 2 deletions
|
@ -23,8 +23,8 @@ void Game::reset_paddles()
|
||||||
{
|
{
|
||||||
m_cursor_paddle_target_y.clear();
|
m_cursor_paddle_target_y.clear();
|
||||||
|
|
||||||
m_player1_paddle.moving_up = false;
|
m_player1_paddle.moving_up = m_up_key_held;
|
||||||
m_player1_paddle.moving_down = false;
|
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_player1_paddle.rect = { game_width - 12, game_height / 2 - 40, m_player1_paddle.width, m_player1_paddle.height };
|
||||||
|
|
||||||
m_player2_paddle.moving_up = false;
|
m_player2_paddle.moving_up = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue