From 5dbaeb120f3467a7eb9458dd6b7f2c1d7a4eb2f9 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 25 May 2025 09:56:43 +0800 Subject: [PATCH] save project --- my_game.py | 8 ++++++++ score.txt | 1 + 2 files changed, 9 insertions(+) create mode 100644 score.txt diff --git a/my_game.py b/my_game.py index 974ee63..ccb2492 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() # 初始化 @@ -57,6 +58,13 @@ old_score = score block_list =pygame.sprite.Group() # 创建精灵组 +with open('score.txt','r',encoding='utf-8')as f: + content = f.read() + record = json.locals(content) + one = content["第1名"] + two = content["第2名"] + three = content["第3名"] + while True: for event in pygame.event.get(): if event.type == locals.QUIT: diff --git a/score.txt b/score.txt new file mode 100644 index 0000000..779a134 --- /dev/null +++ b/score.txt @@ -0,0 +1 @@ +{"第1名": 0, "第2名": 0, "第3名": 0} \ No newline at end of file -- libgit2 0.25.0