Commit b8511924 by BellCodeEditor

save project

parent eee71cfd
Showing with 15 additions and 2 deletions
import pygame
from pygame import locals
import random
import json
pygame.init() # 初始化
class Block(pygame.sprite.Sprite): # 障碍物精灵类
......@@ -42,7 +42,6 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
score_audio=pygame.mixer.Sound("score.wav")
index = 0
y = 400
jumpState = "runing"
......@@ -55,6 +54,12 @@ score=0
old_score=0
speed=8
block_list =pygame.sprite.Group() # 创建精灵组
with open("record.txt","r",encoding="utf-8") as f:
content=f.read()
recond=json.loads(content)
one = recond['第1名']
two = recond['第2名']
three = recond['第3名']
basic_font = pygame.font.Font("STKAITI.TTF",18)
while True:
for event in pygame.event.get():
......@@ -128,6 +133,14 @@ while True:
old_score=score
scoreSurt = basic_font.render("分数:"+str(score),True,(255,255,255))
screen.blit(scoreSurt,(880,20))
scoreSurt = basic_font.render("第一名"+str(score),True,(255,255,255))
screen.blit(scoreSurt,(880,50))
scoreSurt = basic_font.render("第二名"+str(score),True,(255,255,255))
screen.blit(scoreSurt,(880,80))
scoreSurt = basic_font.render("第三名"+str(score),True,(255,255,255))
screen.blit(scoreSurt,(880,80))
# 刷新画面
pygame.display.update()
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