Skip to content

Commit

Permalink
Merge pull request #7 from bragerosberg/feature/better-controls-for-m…
Browse files Browse the repository at this point in the history
…oving

feature: add support for movement through WASD
  • Loading branch information
bragerosberg authored Nov 24, 2021
2 parents 9dcdc50 + ae3453d commit 036f298
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions breakout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 036f298

Please sign in to comment.