Commit 16984193 by BellCodeEditor

save project

parent faa67988
Showing with 14 additions and 3 deletions
...@@ -57,9 +57,9 @@ old_score=0 ...@@ -57,9 +57,9 @@ old_score=0
with open('record.txt','r',encoding='utf-8')as f: 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 one=record["第1名"]
two=record two=record["第2名"]
three=record three=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:
...@@ -123,6 +123,7 @@ while True: ...@@ -123,6 +123,7 @@ 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
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
...@@ -132,6 +133,16 @@ while True: ...@@ -132,6 +133,16 @@ while True:
old_score=score old_score=score
scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0)) scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
screen.blit(scoreSurf,(850,20)) screen.blit(scoreSurf,(850,20))
scoreSurf = basic_font.render("第1名:"+str(one),True,(255,0,0))
screen.blit(scoreSurf,(850,50))
scoreSurf = basic_font.render("第2名:"+str(two),True,(255,0,0))
screen.blit(scoreSurf,(850,80))
scoreSurf = basic_font.render("第3名:"+str(three),True,(255,0,0))
screen.blit(scoreSurf,(850,110))
# 刷新画面 # 刷新画面
pygame.display.update() 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