Commit 9ce852c9 by BellCodeEditor

save project

parent aac7af2b
Showing with 6 additions and 4 deletions
...@@ -48,8 +48,12 @@ while True: ...@@ -48,8 +48,12 @@ while True:
else: else:
y+=30 y+=30
l.append((x,y)) l.append((x,y))
l.pop(0)
if x==apple_x and y==apple_y:
apple_x=random.randrange(0,660,30)
apple_y=random.randrange(0,480,30)
else:
l.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
...@@ -59,9 +63,7 @@ while True: ...@@ -59,9 +63,7 @@ while True:
screen.blit(body,l[i]) screen.blit(body,l[i])
# 将果实画上去 # 将果实画上去
if x==apple_x and y==apple_y:
apple_x=random.randrange(0,660,30)
apple_y=random.randrange(0,480,30)
screen.blit(food, (apple_x, apple_y)) screen.blit(food, (apple_x, apple_y))
# 刷新画面 # 刷新画面
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment