From 1b9462e5dff29f6e69ae64218a2498ab55720845 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Fri, 14 Jun 2024 20:07:14 +0800 Subject: [PATCH] save project --- snake.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/snake.py b/snake.py index 9c26807..44e2420 100644 --- a/snake.py +++ b/snake.py @@ -18,6 +18,8 @@ up = pygame.image.load('up.png') # 头 朝上 down = pygame.image.load('down.png') # 头 朝下 x, y = 240, 120 +appale_x=360 +appale_y=300 position = [(180, 90), (180, 120), (210, 120), (x, y)] setheading = "right" @@ -54,7 +56,7 @@ while True: position.append((x, y)) position.pop(0) - if(x==appale and y==apple_y): + if(x==appale_x and y==appale_y): appale_x=random.randint(0,660) appale_x=random.randint(0,480) # 将背景图画上去 @@ -66,7 +68,7 @@ while True: screen.blit(body, position[i]) # 将果实画上去 - screen.blit(food, (appale_x, apple_y)) + screen.blit(food, (appale_x, appale_y)) # 刷新画面 pygame.display.update() FPSCLOCK.tick(3) \ No newline at end of file -- libgit2 0.25.0