Commit e3be566b by BellCodeEditor

save project

parent a366b99f
Showing with 15 additions and 8 deletions
......@@ -54,14 +54,15 @@ gamestate = True
score=0
speed=0
old_score=0
with open('record.txt','r',encoding='utf-8')as f:
content=f.read()
dict1=json.loads(content) #字典
one=(['第一名'])
two=(['第二名'])
three=(['第三名'])
block_list =pygame.sprite.Group() # 创建精灵组
block_list =pygame.sprite.Group() # 创建精灵组
with open(r'c:\Users\玛酷001\Documents\pygame_lesson9_diy3\record.txt','r',encoding='utf-8') as f:
conten=f.read()
print(conten)
t = json.loads(conten)
one=t["第1名"]
two=t["第2名"]
three=t["第3名"]
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -134,7 +135,12 @@ while True:
old_score=score
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20))
scoreSurf = basic_font.render("第1名:"+str(one),True,(255,0,0)
screen.blit(scoreSurf,(850,50)
scoreSurf = basic_font.render("第2名:"+str(two),True,(255,0,0)
screen.blit(scoreSurf,(850,80)
scoreSurf = basic_font.render("第3名:"+str(three),True,(255,0,0)
screen.blit(scoreSurf,(850,110)
# 刷新画面
pygame.display.update()
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