Commit 619d026c by BellCodeEditor

auto save

parent 41792fd2
Showing with 16 additions and 3 deletions
import pygame
from pygame import locals
import random
import json
pygame.init() # 初始化
......@@ -14,6 +15,7 @@ class Block(pygame.sprite.Sprite): # 障碍物精灵类
# 障碍物绘制坐标
self.rect.x = 1000
self.rect.y = 500 - self.rect.height
class Player(pygame.sprite.Sprite): # 悟空
def __init__(self, image):
......@@ -52,7 +54,19 @@ time = 0
score=0
gamestate = True
block_list =pygame.sprite.Group() # 创建精灵组
block_list =pygame.sprite.Group()
# 创建精灵组
with open('record.txt','r',encoding='utf-8')as f:
content=f.read()
content=json.loads(content)
one=record("第一名")
two=record("第二名")
three=record("第三名")
while True:
for event in pygame.event.get():
......@@ -121,8 +135,7 @@ while True:
if sprite.rect.width+sprite.rect.x<wukong.rect.x:
score+=sprite.score
sprite.score=0
if score>sprite.score: hgfwjkjwadkjaidwdjw
music_score.play()
music_score.play()
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20))
......
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