From ae3453d3131f1bcab3387efec2fe0454d2f5288e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brage=20R=C3=B8sberg?= Date: Wed, 24 Nov 2021 14:23:22 +0100 Subject: [PATCH] Add support for movement through WASD --- breakout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/breakout.py b/breakout.py index 1b56925..5adb491 100644 --- a/breakout.py +++ b/breakout.py @@ -114,11 +114,11 @@ def update(self): """ Update the player position. """ key_pressed = pygame.key.get_pressed() - if key_pressed[pygame.K_RIGHT]: + if key_pressed[pygame.K_RIGHT] | key_pressed[pygame.K_d]: self.rect.x += 13 if self.rect.x > self.screenwidth - self.width: self.rect.x = self.screenwidth - self.width - if key_pressed[pygame.K_LEFT]: + if key_pressed[pygame.K_LEFT] | key_pressed[pygame.K_a]: self.rect.x -= 13 if self.rect.x < 0: self.rect.x = 0