From 96439e8505bb49f45aa2a469d57f435e2224831e Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 7 Jan 2024 18:32:57 +0800
Subject: [PATCH] save project

---
 my_game.py | 20 +++++++++++++++++++-
 score.wav  | Bin 0 -> 26680 bytes
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 score.wav

diff --git a/my_game.py b/my_game.py
index c4f8685..5174d39 100644
--- a/my_game.py
+++ b/my_game.py
@@ -1,6 +1,7 @@
 import pygame
 from pygame import locals
 import random
+import json
 
 pygame.init()  # 初始化
 # 创建一个窗口
@@ -46,9 +47,20 @@ time = 0
 Game = True
 score = 0
 speed = 8
+music_1 = pygame.mixer.Sound("score.wav")
+old_score = 0
+with open("score.txt","r",encoding = "utf-8") as f:
+    content = f.read()
+    record = json.loads(content)
+    one = record["第1名"]
+    two = record["第2名"]
+    three = record["第3名"]
 
 while True:
     speed = 8 + score // 3
+    if score > old_score:
+        music_1.play()
+        old_score = score
     for event in pygame.event.get():
         if event.type == locals.QUIT:
             # 接收到退出事件后退出程序
@@ -112,6 +124,12 @@ while True:
         # 刷新画面
         info = "分数:" + str(score)
         text = font.render(info,True,(255,255,255))
-        screen.blit(text,(900,20))
+        screen.blit(text,(880,20))
+        one_1 = font.render("第一名:" + str(one),True,(255,255,255))
+        screen.blit(one_1,(880,40))
+        two_1 = font.render("第二名:" + str(two),True,(255,255,255))
+        screen.blit(two_1,(880,60))
+        three_1 = font.render("第三名:" + str(one),True,(255,255,255))
+        screen.blit(three_1,(880,80))
         pygame.display.update()
         FPS.tick(60)
\ No newline at end of file
diff --git a/score.wav b/score.wav
new file mode 100644
index 0000000..0c021f3
Binary files /dev/null and b/score.wav differ
--
libgit2 0.25.0