Commit 322b9301 by BellCodeEditor

save project

parent a9c7376f
Showing with 18 additions and 2 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
import json
pygame.init() # 初始化 pygame.init() # 初始化
score =0 score =0
...@@ -53,6 +54,12 @@ time = 0 ...@@ -53,6 +54,12 @@ time = 0
gamestate = True gamestate = True
old = 0 old = 0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
with open("record.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: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -125,8 +132,16 @@ while True: ...@@ -125,8 +132,16 @@ while True:
audio.play() audio.play()
old = score old = score
scoreSurf = basic_font.render("Score:"+str(score),True,(144,238,144))
scoreSurf = basic_font.font.render("分数:"+str())) screen.blit(scoreSurf,(850,20))
one_q = basic_font.render("第一:"+str(one),True,(144,238,144))
screen.blit(one_q,(850,40))
two_e = basic_font.render("第二:"+str(two),True,(144,238,144))
screen.blit(two_e,(850,60))
three_q= basic_font.render("第三:"+str(three),True,(144,238,144))
screen.blit(three_q,(850,80))
# 刷新画面 # 刷新画面
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