Commit ababf919 by BellCodeEditor

save project

parent 7b631555
Showing with 12 additions and 2 deletions
...@@ -22,6 +22,9 @@ down = pygame.image.load('down.png') ...@@ -22,6 +22,9 @@ down = pygame.image.load('down.png')
x,y=240,120 x,y=240,120
staion=[(180,90),(180,120),(210,120),(x,y)] staion=[(180,90),(180,120),(210,120),(x,y)]
his_font = pygame.font.Font('neuropol.ttf',18)
score=0
setheading = "right" setheading = "right"
snack_head = right snack_head = right
apple_x,apple_y = 360,300 apple_x,apple_y = 360,300
...@@ -65,6 +68,7 @@ while True: ...@@ -65,6 +68,7 @@ while True:
nam2 = random.randint(1,16) nam2 = random.randint(1,16)
apple_x=nam1*30 - 30 apple_x=nam1*30 - 30
apple_y=nam2*30 - 30 apple_y=nam2*30 - 30
score+=20
else: else:
staion.pop(0) staion.pop(0)
...@@ -77,6 +81,12 @@ while True: ...@@ -77,6 +81,12 @@ while True:
screen.blit(body,staion[i]) screen.blit(body,staion[i])
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x,apple_y)) screen.blit(food, (apple_x,apple_y))
info = "Score:"+str(score)
text = his_font.render(info,True,(0,0,0))
screen.blit(text,(540,10))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK .tick(2) FPSCLOCK.tick(2)
\ 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