Commit d91e5ad0 by BellCodeEditor

save project

parent c3d7842a
Showing with 9 additions and 4 deletions
......@@ -54,10 +54,14 @@ while True:
else:
y += 30
if x==ax and y==ay:
ax=random.randint(0,600)
ay=random.randint(0,480)
sx=random.randint(1,22)
sy=random.randint(1,15)
ax=sx*30-30
ay=sy*30-30
else:
position.pop(0)
position.append((x, y))
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇的头画上去
......@@ -67,7 +71,7 @@ while True:
screen.blit(body, position[i])
# 将果实画上去
screen.blit(food, (ax, ay))
screen.blit(food, (ax,ay))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
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