diff --git a/main.py b/main.py index 6db0c09..7f9e1aa 100644 --- a/main.py +++ b/main.py @@ -60,6 +60,14 @@ def main(): snake.direction = Direction.UP elif event.key == pglocals.K_RIGHT or event.key == pglocals.K_d: snake.direction = Direction.RIGHT + elif event.key == pglocals.K_ESCAPE: + pause = True + while pause: + clock.tick(5) + for event in pygame.event.get(): + if event.type == pglocals.KEYDOWN and event.key == pglocals.K_ESCAPE: + pause = False + break dirty_rects = snake.move(screen, apple) if snake.dead: