From 02ff57428b5f00697f3ab4d99070a2b9322ec819 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 24 Sep 2023 09:55:30 +0800 Subject: [PATCH] save project --- snake.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snake.py b/snake.py index 537316e..0008326 100644 --- a/snake.py +++ b/snake.py @@ -52,6 +52,9 @@ while True: else: y += 30 position.append((x, y)) + if x==apple_x and y==apple_y: + apple_x=random.randint(0,660) + apple_y=random.randint(0,480) position.pop(0) # 将背景图画上去 screen.blit(background, (0, 0)) -- libgit2 0.25.0