Commit 59909633 by BellCodeEditor

save project

parent a95fc94b
Showing with 8 additions and 9 deletions
...@@ -48,15 +48,14 @@ while True: ...@@ -48,15 +48,14 @@ while True:
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if setheading == "right": if setheading == "right":
x += 3 x += 30
elif setheading == "left": elif setheading == "left":
x -= 3 x -= 30
elif setheading == "up": elif setheading == "up":
y -= 3 y -= 30
else: else:
y += 3 y += 30
if x < 0 or x > 630 or y < 0 or y > 450:
exit()
position.append((x, y)) position.append((x, y))
# 将背景图画上去 # 将背景图画上去
...@@ -80,5 +79,5 @@ while True: ...@@ -80,5 +79,5 @@ while True:
text=myFont.render('score:'+str(score),True , (0,0,0)) text=myFont.render('score:'+str(score),True , (0,0,0))
screen.blit(text,(540,10)) screen.blit(text,(540,10))
# 刷新画面 # 刷新画面
pygame.display.u apdat() pygame.display.update()
FPSCLOCK.tick(50) FPSCLOCK.tick(3)
\ No newline at end of file \ 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