Skip to content

Commit 75d3013

Browse files
authored
Merge pull request #3151 from adafruit/TheKitty-patch-12
Enhance game over message with quit instructions
2 parents 5b24a43 + 935002c commit 75d3013

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Metro/Metro_RP2350_Breakout/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def check_keys():
177177
r_pressed = True
178178
elif key == ' ': # Space for start/launch
179179
s_pressed = True
180+
elif key in ('q', 'Q') or ord(key) == 27: # q, Q, or ESC is quit
181+
sys.exit(0) # We're out of here
180182
except Exception as e: # pylint: disable=broad-except
181183
print("Input error:", e)
182184

@@ -420,7 +422,7 @@ def update_message(text):
420422
if lives <= 0:
421423
game_active = False
422424
game_over = True
423-
update_message("GAME OVER - Press SPACE to play again")
425+
update_message("GAME OVER - Press SPACE to play again, Q to quit")
424426

425427
# Play game over sound
426428
play_game_over()

0 commit comments

Comments
 (0)