diff --git a/snake.py b/snake.py index 495c492..f79086f 100644 --- a/snake.py +++ b/snake.py @@ -1,5 +1,4 @@ import pygame -import random from pygame import locals # 初始化pygame,为使用硬件做准备 @@ -25,7 +24,6 @@ apple_y=300 setheading = "right" snake_head = right - while True: for event in pygame.event.get(): if event.type == locals.QUIT: @@ -57,7 +55,7 @@ while True: position.append((x, y)) if x ==apple_x and y==apple_y: apple_x=random.randint(0,660) - apple_y=random.randint(0.480) + apple_y=random.randint(0,480) position.pop(0) # 将背景图画上去