Commit 23e8e16e by BellCodeEditor

save project

parent 4f39131f
Showing with 7 additions and 4 deletions
......@@ -22,7 +22,6 @@ x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
food_x=300
food_y=300
setheading = "right"
snake_head = right
......@@ -55,7 +54,6 @@ while True:
else:
y += 30
position.append((x, y))
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇的头画上去
......@@ -63,9 +61,14 @@ while True:
# 将贪吃蛇的身体画上去
for i in range(len(position)-1):
screen.blit(body, position[i])
if x==food_x and y==food_y:
food_x=random.randint(0,660)
food_y=random.randint(0,480)
gj1=random.randint(1,22)
gj2=random.randint(1,16)
food_x=gj1*30-30
food_y=gj2*30-30
else:
position.pop(0)
# 将果实画上去
screen.blit(food, (food_x, food_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