From e7171ae8ed9351dde387cbc0193999020f5f92c0 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Fri, 30 Apr 2021 20:37:08 +0800 Subject: [PATCH] save project --- snake.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snake.py b/snake.py index 9482635..b6d9049 100644 --- a/snake.py +++ b/snake.py @@ -16,7 +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.ttf",20) +score = 0 x, y = 240, 120 position = [(180, 90), (180, 120), (210, 120), (x, y)] SB_x=300 @@ -69,9 +70,13 @@ while True: # 将贪吃蛇的身体画上去 for i in range(len(position)-1): screen.blit(body, position[i]) + # 将果实画上去 screen.blit(food, (SB_x,SB1_y)) + info="Score: "+str(score) + text = my_font.render(info,True,(0,0,0)) + screen.blit(text,(0,0)) # 刷新画面 pygame.display.update() FPSCLOCK.tick(3) \ No newline at end of file -- libgit2 0.25.0