Commit b7edf438 by BellCodeEditor

save project

parent f0d006e7
Showing with 17 additions and 4 deletions
...@@ -127,18 +127,31 @@ while True: ...@@ -127,18 +127,31 @@ 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>thr:
if score>one:
record['第1名']=score
record['第2名']=one
record['第3名']=two
elif score>two:
record['第2名']=score
record['第3名']=two
else:
record['第3名']=score
record=json.dumps(record,ensure_ascii=False)
with open('record.txt','w',encoding='utf-8') as f:
f.write(record)
else: else:
if (prop.rect.x+prop.rect.width)<wukong.rect.x: if (prop.rect.x+prop.rect.width)<wukong.rect.x:
score+=prop.score score+=prop.score
prop.score=0 prop.score=0
f = basic_font.render('分数:'+str(score),True,(255,0,0)) f = basic_font.render('分数:'+str(score),True,(255,0,0))
screen.blit(f,(880,20)) screen.blit(f,(850,20))
a = basic_font.render('第一名:'+str(one),True,(255,0,0)) a = basic_font.render('第一名:'+str(one),True,(255,0,0))
screen.blit(a,(880,50)) screen.blit(a,(850,50))
b = basic_font.render('第二名:'+str(two),True,(255,0,0)) b = basic_font.render('第二名:'+str(two),True,(255,0,0))
screen.blit(b,(880,80)) screen.blit(b,(850,80))
c = basic_font.render('第三名:'+str(thr),True,(255,0,0)) c = basic_font.render('第三名:'+str(thr),True,(255,0,0))
screen.blit(c,(880,110)) screen.blit(c,(850,110))
if score > old_score: if score > old_score:
score_audio.play() score_audio.play()
old_score=score old_score=score
......
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