Commit a366b99f by BellCodeEditor

auto save

parent d4675754
Showing with 14 additions and 7 deletions
import json
jsonData ='{"第一名":122,"第二名":109,"第三名":188}';
text=json.loads(jsonData)
print("第一名",text["第一名"])
print('第二名',text["第二名"])
print('第三名',text["第三名"])
...@@ -54,14 +54,14 @@ gamestate = True ...@@ -54,14 +54,14 @@ gamestate = True
score=0 score=0
speed=0 speed=0
old_score=0 old_score=0
block_list =pygame.sprite.Group() # 创建精灵组
with open('record.txt','r',encoding='utf-8')as f: with open('record.txt','r',encoding='utf-8')as f:
content=f.read() content=f.read()
json.loads(content) dict1=json.loads(content) #字典
record=one('第一名') one=(['第一名'])
record=two('第二名') two=(['第二名'])
record=three('第三名') three=(['第三名'])
block_list =pygame.sprite.Group() # 创建精灵组
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -134,7 +134,7 @@ while True: ...@@ -134,7 +134,7 @@ while True:
old_score=score old_score=score
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20)) screen.blit(scoreSurf,(850,20))
screen.blit(record)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
\ No newline at end of file
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