From ef3f9b24dd28ee32564fdcf50857161066dfaf0e Mon Sep 17 00:00:00 2001 From: Matheus Vinicius Date: Wed, 15 Sep 2021 02:17:53 -0300 Subject: [PATCH] Breakout: Add possibility to play with A and D This change will make the player able to control the game with A and D keys, in addition to the current arrow keys and mouse. --- Userland/Games/Breakout/Game.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Games/Breakout/Game.cpp b/Userland/Games/Breakout/Game.cpp index 5722194a5b..972eba62f9 100644 --- a/Userland/Games/Breakout/Game.cpp +++ b/Userland/Games/Breakout/Game.cpp @@ -152,9 +152,11 @@ void Game::keyup_event(GUI::KeyEvent& event) if (m_paused) return; switch (event.key()) { + case Key_A: case Key_Left: m_paddle.moving_left = false; break; + case Key_D: case Key_Right: m_paddle.moving_right = false; break; @@ -171,9 +173,11 @@ void Game::keydown_event(GUI::KeyEvent& event) case Key_Escape: GUI::Application::the()->quit(); break; + case Key_A: case Key_Left: m_paddle.moving_left = true; break; + case Key_D: case Key_Right: m_paddle.moving_right = true; break;