forked from ndyer/pygame-dvd
added the ability to quit by pressing esc.
This commit is contained in:
parent
afe58c15a8
commit
2957bb867f
@ -197,6 +197,11 @@ class Surface(pygame.Surface):
|
||||
# Stop the game when a user clicks anywhere on the screen.
|
||||
self.running = False
|
||||
self.quit = True
|
||||
case pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
# Also stop the game if the Escape key is pressed.
|
||||
self.running = False
|
||||
self.quit = True
|
||||
|
||||
# Update positions and speeds of all sprites (in this case, just one logo sprite).
|
||||
self.all_sprites.update()
|
||||
|
Loading…
Reference in New Issue
Block a user