Commit 41d53849 by BellCodeEditor

save project

parent 1f34f275
Showing with 15 additions and 0 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
import json
pygame.init() # 初始化 pygame.init() # 初始化
...@@ -57,6 +58,13 @@ ole_score=0 ...@@ -57,6 +58,13 @@ ole_score=0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
with open('record.txt','r',encoding='utf-8') as f:
centent = f.read()
record = json.loads(centent)
first = record["第1名"]
second = record["第2名"]
third = record["第3名"]
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -126,6 +134,13 @@ while True: ...@@ -126,6 +134,13 @@ while True:
sprite.score = 0 sprite.score = 0
scoreSurf = basic_font.render("分数:"+str(score),True,(255,180,180)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,180,180))
screen.blit(scoreSurf,(900,20)) screen.blit(scoreSurf,(900,20))
scoreSurf = basic_font.render("第一名:"+str(first),True,(255,180,180))
screen.blit(scoreSurf,(900,50))
scoreSurf = basic_font.render("第二名:"+str(second),True,(255,180,180))
screen.blit(scoreSurf,(900,80))
scoreSurf = basic_font.render("第三名:"+str(third),True,(255,180,180))
screen.blit(scoreSurf,(900,110))
if ole_score<score: if ole_score<score:
vioce.play() vioce.play()
ole_score=score ole_score=score
......
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