Commit 14b7f52e by BellCodeEditor

auto save

parent d2ebfd3d
Showing with 8 additions and 5 deletions
...@@ -49,7 +49,8 @@ jumpState = "runing" ...@@ -49,7 +49,8 @@ jumpState = "runing"
t = 30 t = 30
road_x = 0 road_x = 0
bg_x = 0 bg_x = 0
time = 0 time = 0]
thr = record["第
gamestate = True gamestate = True
score=0 score=0
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
...@@ -57,8 +58,7 @@ with open('record.txt','r',encoding = 'utf-8') as f: ...@@ -57,8 +58,7 @@ with open('record.txt','r',encoding = 'utf-8') as f:
content = f.read() content = f.read()
record = json.loads(content) record = json.loads(content)
one = record["1"] one = record["1"]
two = record["第2名"] two = record["2"3名"]
thr = 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:
...@@ -122,12 +122,15 @@ while True: ...@@ -122,12 +122,15 @@ while True:
gameover = pygame.image.load('gameover.png') # 游戏结束 gameover = pygame.image.load('gameover.png') # 游戏结束
screen.blit(gameover, (400, 200)) screen.blit(gameover, (400, 200))
gamestate = False gamestate = False
if score >three:
if score > one:
else: else:
if(sprite.rect.x +sprite.rect.width) < wukong.rect.x: if(sprite.rect.x +sprite.rect.width) < wukong.rect.x:
score +=sprite.score score +=sprite.score
sprite.score = 0 sprite.score = 0
scoreSurf = basic_font.render("分数:"+str(score),True,(255,225,225)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,225,225))
screen.blit(scoreSurf,(880,20)) screen.blit(scoreSurf,(880,20))
scoreSurf = basic_font.render("分数:"+str(one),True,(255,225,225)) scoreSurf = basic_font.render("分数:"+str(one),True,(255,225,225))
......
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