From f0cdccf48fd144d89c49058b80af3b449dd3be29 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Fri, 13 Aug 2021 12:49:53 +0800 Subject: [PATCH] save project --- snake.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snake.py b/snake.py index f84f70c..77aebe7 100644 --- a/snake.py +++ b/snake.py @@ -59,8 +59,12 @@ while True: num2 = random.randint(1,16) apple_x = num1 * 30 - 30 apple_y = num2 * 30 - 30 + score += 10 else: position.pop(0) + + if x < 0 or x > 630 or y < 0 or y > 630: + exit() # 将背景图画上去 screen.blit(background, (0, 0)) # 将贪吃蛇的头画上去 -- libgit2 0.25.0