Commit ababf919 by BellCodeEditor

save project

parent 7b631555
Showing with 13 additions and 3 deletions
......@@ -22,6 +22,9 @@ down = pygame.image.load('down.png')
x,y=240,120
staion=[(180,90),(180,120),(210,120),(x,y)]
his_font = pygame.font.Font('neuropol.ttf',18)
score=0
setheading = "right"
snack_head = right
apple_x,apple_y = 360,300
......@@ -65,9 +68,10 @@ while True:
nam2 = random.randint(1,16)
apple_x=nam1*30 - 30
apple_y=nam2*30 - 30
score+=20
else:
staion.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
......@@ -77,6 +81,12 @@ while True:
screen.blit(body,staion[i])
# 将果实画上去
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()
FPSCLOCK .tick(2)
\ No newline at end of file
FPSCLOCK.tick(2)
\ 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