Commit 323349d2 by BellCodeEditor

save project

parent fbf40d32
Showing with 10 additions and 4 deletions
...@@ -18,12 +18,14 @@ down = pygame.image.load('down.png') ...@@ -18,12 +18,14 @@ down = pygame.image.load('down.png')
up = pygame.image.load('up.png') up = pygame.image.load('up.png')
food = pygame.image.load('apple.png') food = pygame.image.load('apple.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
my_font=pygame.font.Font('neuropol.ttf',18)
x,y=240, 120 x,y=240, 120
z=[(180, 90),(180, 120),(210, 120),(x,y)] z=[(180, 90),(180, 120),(210, 120),(x,y)]
fx='right' fx='right'
fx_t=right fx_t=right
apple_x,apple_y=360, 300 apple_x,apple_y=360, 300
score=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -62,6 +64,7 @@ while True: ...@@ -62,6 +64,7 @@ while True:
a_y=random.randint(0,15) a_y=random.randint(0,15)
apple_x=a_x*30 apple_x=a_x*30
apple_y=a_y*30 apple_y=a_y*30
score+=10
else: else:
z.pop(0) z.pop(0)
...@@ -74,8 +77,12 @@ while True: ...@@ -74,8 +77,12 @@ while True:
screen.blit(body,z[i]) screen.blit(body,z[i])
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x,apple_y)) screen.blit(food, (apple_x,apple_y))
f.tick(3) info='Score'+str(score)
test=my_font.render(info,True,(0,0,0))
screen.blit(test,(540,10))
f.tick(8)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ 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