Commit b04c112a by BellCodeEditor

save project

parent de290401
Showing with 18 additions and 2 deletions
import pygame
from pygame import locals
import random
import json
pygame.init() # 初始化
......@@ -53,6 +54,13 @@ score=0
speed=8
old_score=0
block_list =pygame.sprite.Group() # 创建精灵组
with open("record.txt","r",encoding="utf-8")as file:
content=file.read()
aao=json.loads(content)
info1=aao["第1名"]
info2=aao["第2名"]
info3=aao["第3名"]
while True:
for event in pygame.event.get():
......@@ -126,7 +134,14 @@ while True:
screen.blit(text,(800,100))
if score>old_score:
score_audio.play()
score=old_score
# 刷新画面
old_score=score
myt1=pygame.font.Font("STKAITI.TTF",28)
text1=myt1.render("第一名得分"+str(info1),True,(0,0,0))
screen.blit(text1,(800,150))
text2=myt1.render("第二名得分"+str(info2),True,(0,0,0))
screen.blit(text2,(800,200))
text3=myt1.render("第三名得分"+str(info3),True,(0,0,0))
screen.blit(text3,(800,250))
# 刷新画面
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