Commit e3735779 by BellCodeEditor

save project

parent 7fc1d2ac
Showing with 5 additions and 4 deletions
......@@ -42,8 +42,8 @@ while True:
snake_head = down
# 设置贪吃蛇的头部坐标
if x < 0 or x > 630 or y < 0 or y > 450:
exit()
if setheading == "down":
y += 30
if setheading == "right":
x += 30
elif setheading == "left":
......@@ -56,6 +56,7 @@ while True:
if x == pingguox and y == pingguoy:
pingguox = randint(1,22)*30-30
pingguoy = randint(1,16)*30-30
score += 200
else:
position.pop(0)
# 将背景图画上去
......@@ -72,4 +73,4 @@ while True:
screen.blit(food, (pingguox, pingguoy))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(20)
\ No newline at end of file
FPSCLOCK.tick(10)
\ 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