diff --git a/snake.py b/snake.py index 7fcd541..b979954 100644 --- a/snake.py +++ b/snake.py @@ -56,9 +56,12 @@ while True: y += 30 position.append((x, y)) if x==apple_x and y==apple_y: - apple_x=random.randint(0,660) - apple_y=random.randint(0,480) - position.pop(0) + bb=random.randint(0,21) + pp=random.randint(0,15) + apple_x=bb*30 + apple_y=pp*30 + else: + position.pop(0) # 将背景图画上去