Commit f1d5c5a4 by BellCodeEditor

save project

parent 6ac34909
Showing with 16 additions and 2 deletions
...@@ -128,6 +128,20 @@ while True: ...@@ -128,6 +128,20 @@ 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>third:
if score>first:
record['第1名'] = score
record['第2名'] = first
record['第3名'] = second
elif score>second:
record['第2名'] = score
record['第3名'] = second
else:
record['第3名'] = score
record=json.dumps(record,ensure_ascii=False)
with open('record.txt','w',encoding='utf-8') as s:
s.write(record)
else: else:
if wukong.rect.x - sprite.rect.width > sprite.rect.x: if wukong.rect.x - sprite.rect.width > sprite.rect.x:
score+=sprite.score score+=sprite.score
......
{"第1名": 0, "第2名": 0, "第3名": 0} {"第1名": 22, "第2名": 11, "第3名": 10}
\ No newline at end of file \ 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