Commit 0fe6e74a by BellCodeEditor

auto save

parent 181c05c5
Showing with 7 additions and 6 deletions
......@@ -52,7 +52,13 @@ while True:
else:
y += 30
position.append((x, y))
position.pop(0)
if x==fx and y==fy:
nx=randint(1,22)
ny=randint(1,16)
fx=nx*30-30
fy=nx*30-30
else:
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇的头画上去
......@@ -60,11 +66,6 @@ while True:
# 将贪吃蛇的身体画上去
for i in range(len(position)-1):
screen.blit(body, position[i])
if x==fx and y==fy:
fx=randint(0,660)
fy=randint(0,480)
# 将果实画上去
screen.blit(food, (fx, fy))
# 刷新画面
......
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