Commit b54409c2 by BellCodeEditor

save project

parent dc57c1e6
Showing with 10 additions and 3 deletions
......@@ -25,6 +25,10 @@ position = [(180, 90), (180, 120), (210, 120), (x, y)]
setheading = "right"
snake_head = right
score=0
my_font=pygame.font.Font("neuropol.ttf",18)
while True:
for event in pygame.event.get():
......@@ -60,6 +64,7 @@ while True:
app_y=random.randint(0,16)
app_x=app_x*30-30
app_y=app_y*30-30
score=score+1
else:
position.pop(0)
# 将背景图画上去
......@@ -69,9 +74,12 @@ while True:
# 将贪吃蛇的身体画上去
for i in range(len(position)-1):
screen.blit(body, position[i])
info="score"+str(score)
text = my_font.render(info,True,(0,0,0))
screen.blit(text,(550,0))
# 将果实画上去
screen.blit(food, (app_x, app_y))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
FPSCLOCK.tick(3)
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