Commit b1070a18 by BellCodeEditor

save project

parent bc84c8c1
Showing with 35 additions and 25 deletions
......@@ -85,14 +85,15 @@ obg=Rsc(stone,cacti,apple)
wukong=heros(hero[index])
blist=pygame.sprite.Group()
with open('record.txt','r',encoding='utf-8') as f:
cont=f.read()
text=json.loads(cont)
print(cont)
one=text['第一名']
two=text['第二名']
three=text['第三名']
while True:
with open('record.txt','r',encoding='utf-8') as f:
cont=f.read()
text=json.loads(cont)
print(cont)
one=text['第1名']
two=text['第2名']
three=text['第3名']
wukong=heros(hero[index])
if gametate==True:
time+=1
......@@ -103,10 +104,10 @@ while True:
blist.add(obg)
time=10
s_c=score//3
speed=8+s_c+p
speed=12+s_c+p
if IM=='running':
ind+=1
if ind>=5:
if ind>=3:
index+=1
ind=0
if index==5:
......@@ -122,10 +123,10 @@ while True:
text['第二名']=score
text['第三名']=two
else:
text['第三名']=three
text['第三名']=score
text=json.dumps(text,ensure_ascii=False)
with open('record.txt','w',encoding='utf-8') as f:
cont=f.write()
f.write(text)
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
......@@ -152,6 +153,13 @@ while True:
obg=Rsc(stone,cacti,apple)
blist.add(obg)
if gametate==True:
with open('record.txt','r',encoding='utf-8') as f:
cont=f.read()
text=json.loads(cont)
print(cont)
one=text['第一名']
two=text['第二名']
three=text['第三名']
if IM=='up':
y-=G
wukong.rect.y=y
......@@ -202,20 +210,22 @@ while True:
pop.score=0
else:
screen.blit(go,(400,200))
gametate=False
if score>three:
if score>one:
text['第一名']=score
text['第二名']=one
text['第三名']=two
elif score>two:
text['第二名']=score
text['第三名']=two
else:
text['第三名']=three
gametate=False
if score>one:
text['第一名']=score
text['第二名']=one
text['第三名']=two
if score>two:
text['第一名']=one
text['第二名']=score
text['第三名']=two
if score>two:
text['第一名']=one
text['第二名']=two
text['第三名']=score
text=json.dumps(text,ensure_ascii=False)
with open('record.txt','w',encoding='utf-8') as f:
cont=f.write()
f.write(text)
else:
if (pop.rect.x+pop.rect.width)<=wukong.rect.x:
score+=pop.score
......
{"第1名": 902, "第2名": 0, "第3名": 0}
\ No newline at end of file
{"第一名": 31, "第二名": 7, "第三名": 5}
\ 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