From 26c3b87f723f626244c8c50e52fe0eab2d02bb1e Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 28 Nov 2021 11:28:05 +0800 Subject: [PATCH] save project --- snake.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snake.py b/snake.py index e041321..84ab0c5 100644 --- a/snake.py +++ b/snake.py @@ -1,6 +1,6 @@ import pygame from pygame import locals - +import random # 初始化pygame,为使用硬件做准备 pygame.init() @@ -20,7 +20,7 @@ down = pygame.image.load('down.png') # 头 朝下 x, y = 240, 120 position = [(180, 90), (180, 120), (210, 120), (x, y)] apple_x = 360 -apple_y = 360 +apple_y = 300 setheading = "right" snake_head = right @@ -55,7 +55,7 @@ while True: y += 30 position.append((x, y)) position.pop(0) - if x == apple_x and y ==apple_y + if x == apple_x and y ==apple_y: apple_x = random.randint(0, 660) apple_y = random.randint(0, 480) # 将背景图画上去 -- libgit2 0.25.0