From 0bacec392fd06a9d5743f67667c56a0b8ece4068 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 29 Dec 2024 14:27:54 +0800
Subject: [PATCH] save project

---
 snake.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/snake.py b/snake.py
index 1b8f464..a7257ee 100644
--- a/snake.py
+++ b/snake.py
@@ -17,12 +17,14 @@ 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',18)
 x, y = 240, 120
 position = [(180, 90), (180, 120), (210, 120), (x, y)]
 x_apple=360
 y_apple=300
 setheading = "right"
 snake_head = right
+    score = 0
 
 while True:
     for event in pygame.event.get():
@@ -70,6 +72,9 @@ while True:
 
     # 将果实画上去
     screen.blit(food, (x_apple,y_apple ))
+    info = "Score:"+str(score)
+    text = my_font.render(info, True, (0,0,0))
+    screen.blit(text, (540, 10))
     # 刷新画面
-    pygame.display.update()
+    pygame.display.update() 
     FPSCLOCK.tick(3)
\ No newline at end of file
--
libgit2 0.25.0