Commit 07d5e9c2 by BellCodeEditor

save project

parent 559b45b0
Showing with 15 additions and 2 deletions
import pygame
from pygame import locals
import random
import json
pygame.init() # 初始化
class Block(pygame.sprite.Sprite): # 障碍物精灵类
......@@ -43,7 +43,13 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero5.png')]
score_music=pygame.mixer.Sound('score.wav')
basic_font = pygame.font.Font('MSYH.TTF',18)
index = 0
with open('record.txt','r',encoding='utf-8')as f:
cen=f.read()
record=json.loads(cen)
one=record["第1名"]
two=record["第2名"]
three=record["第3名"]
index = 0
y = 400
jumpState = "runing"
t = 30
......@@ -125,6 +131,12 @@ while True:
sprite.score=0
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20))
scoreSurf = basic_font.render("第1名:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,50))
scoreSurf = basic_font.render("第2名:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,80))
scoreSurf = basic_font.render("第3名:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,110))
# 刷新画面
pygame.display.update()
FPS.tick(30)
\ 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