Commit 62f5c95b by BellCodeEditor

save project

parent b8ed9409
Showing with 16 additions and 3 deletions
...@@ -111,7 +111,7 @@ while True: ...@@ -111,7 +111,7 @@ while True:
bg_x-=1 bg_x-=1
#if zaw.rect.x<= 0-zaw.rect.width: #if zaw.rect.x<= 0-zaw.rect.width:
time+=1 time+=1
if time>=60: if time>=45:
time=0 time=0
num=random.randint(1,50) num=random.randint(1,50)
if num>20: if num>20:
...@@ -126,6 +126,19 @@ while True: ...@@ -126,6 +126,19 @@ while True:
gmover=pygame.image.load('gameover.png') gmover=pygame.image.load('gameover.png')
screen.blit(gmover,(400,250)) screen.blit(gmover,(400,250))
gameover=True gameover=True
if score>r1:
record['第一名']=score
record['第二名']=r1
record['第三名']=r2
elif score>r2:
record['第二名']=score
record['第三名']=r2
else:
record['第三名']=score
record=json.dumps(record,ensure_ascii=False)
with open('score.txt','w',encoding='utf-8') as w:
w.write(record)
else: else:
if i.rect.x<wukong_1.rect.x: if i.rect.x<wukong_1.rect.x:
score+=i.score score+=i.score
......
{"第一名":0,"第二名":0,"第三名":0} {"第一名": 19, "第二名": 3, "第三名": 1}
\ 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