From 6e35eaa970d2773a7467ef317b939131f6a6551f Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 17 Sep 2023 17:03:35 +0800 Subject: [PATCH] save project --- snake.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/snake.py b/snake.py index a9b0d08..e089281 100644 --- a/snake.py +++ b/snake.py @@ -54,9 +54,12 @@ while True: y += 30 position.append((x, y)) if x == xa and y == ya: - xa = random.randint(0,660) - xa = 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