From 7c631b696d9336ee371c41b59ba636cc5fad227d Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 17 Sep 2023 17:04:11 +0800 Subject: [PATCH] save project --- snake.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/snake.py b/snake.py index a8f0376..a7713d7 100644 --- a/snake.py +++ b/snake.py @@ -55,9 +55,12 @@ while True: y += 30 position.append((x, y)) if x == xa and y == ya: - xa =random.randint(0,660) - ya =random.randint(0,480) - position.pop(0) + n1 =random.randint(0,21) + n2 =random.randint(0,15) + xa = n1 * 30 + ya = n2 * 30 + else: + position.pop(0) # 将背景图画上去 screen.blit(background, (0, 0)) # 将贪吃蛇的头画上去 -- libgit2 0.25.0