Commit a7381968 by BellCodeEditor

auto save

parent 7d92efe4
Showing with 6 additions and 3 deletions
...@@ -53,7 +53,6 @@ while True: ...@@ -53,7 +53,6 @@ while True:
else: else:
y += 30 y += 30
position.append((x, y)) position.append((x, y))
position.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇的头画上去 # 将贪吃蛇的头画上去
...@@ -62,8 +61,12 @@ while True: ...@@ -62,8 +61,12 @@ while True:
for i in range(len(position)-1): for i in range(len(position)-1):
screen.blit(body, position[i]) screen.blit(body, position[i])
if dejecta_x==x and dejecta_y==y: if dejecta_x==x and dejecta_y==y:
dejecta_x=random.randint(0,660) num1=random.randint(0,21)
dejecta_y=random.randint(0,660) num2=random.randint(0,15)
dejecta_x=numn1*30
dejecta_y=numn2*30
else:
position.pop(0)
# 将果实画上去 # 将果实画上去
screen.blit(food, (dejecta_x, dejecta_y)) screen.blit(food, (dejecta_x, dejecta_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