Commit 0d85963c by BellCodeEditor

save project

parent c161359a
Showing with 6 additions and 2 deletions
......@@ -16,8 +16,8 @@ body = pygame.image.load('body.png') # 身体
left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
my_font=pygame.font.Font('neuropol.tty,18')
my_font=pygame.font.Font("neuropol.ttf",20)
score=0
x, y = 240, 120
apple_x=300
apple_y=330
......@@ -54,6 +54,7 @@ while True:
y += 30
position.append((x, y))
if x==apple_x and y==apple_y:
score=score+10
apple_x=30*random.randint(0,21)
apple_y=30*random.randint(0,15)
else:
......@@ -70,6 +71,9 @@ while True:
# 将果实画上去
screen.blit(food, (apple_x, apple_y))
into="Score"+str(score)
text = my_font.render(into,True,(0,0,0))
screen.blit(text,(0,0))
# 刷新画面
pygame.display.update()
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