Commit 494c8bcd by BellCodeEditor

save project

parent 214fd3dc
Showing with 13 additions and 5 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
import json
pygame.init() # 初始化 pygame.init() # 初始化
class Block(pygame.sprite.Sprite): # 障碍物精灵类 class Block(pygame.sprite.Sprite): # 障碍物精灵类
...@@ -58,11 +58,12 @@ old=0 ...@@ -58,11 +58,12 @@ old=0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
with open("record.txt",'r',encoding='uft-8') as f: with open("record.txt",'r',encoding='utf-8') as f:
n=f.read() n=f.read()
one = n["第1名"] n1 = json.loads(n)
two = n["第2名"] one = n1["第1名"]
three = n["第3名"] two = n1["第2名"]
three = n1["第3名"]
print(one,two,three) print(one,two,three)
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -138,6 +139,13 @@ while True: ...@@ -138,6 +139,13 @@ while True:
fs = zt.render("分数"+str(score),True,(255,255,255)) fs = zt.render("分数"+str(score),True,(255,255,255))
screen.blit(fs,(880,20)) screen.blit(fs,(880,20))
fs = zt.render("分数"+str(one),True,(255,255,255))
screen.blit(fs,(880,50))
fs = zt.render("分数"+str(two),True,(255,255,255))
screen.blit(fs,(880,80))
fs = zt.render("分数"+str(three),True,(255,255,255))
screen.blit(fs,(880,110))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
......
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