Commit fa0f764c by BellCodeEditor

save project

parent 765bc5df
Showing with 19 additions and 1 deletions
import pygame
from pygame import locals
import random
import json
pygame.init() # 初始化
class Block(pygame.sprite.Sprite): # 障碍物精灵类
......@@ -54,6 +54,14 @@ score=0
speed=8
old_score=0
with open(r"record.txt","r",encoding="utf-8")as f:
content=f.read()
record=json.loads(content)
one=content["第一名"]
two=content["第二名"]
thr=content["第三名"]
block_list =pygame.sprite.Group() # 创建精灵组
......@@ -128,6 +136,15 @@ while True:
score_audio.play()
score=old_score
scoreSurf=basic_font.render("分数:"+str(score),true,255,255,255)
screen.blit(scoreSurf,(880,20))
scoreSurf=basic_font.render("第一名:"+str(one),true,255,255,255)
screen.blit(scoreSurf,(880,50))
scoreSurf=basic_font.render("第二名:"+str(two),true,255,255,255)
screen.blit(scoreSurf,(880,80))
scoreSurf=basic_font.render("第三名:"+str(thr),true,255,255,255)
screen.blit(scoreSurf,(880,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