Commit c9eb17ba by BellCodeEditor

save project

parent b8b71ead
Showing with 19 additions and 7 deletions
......@@ -47,7 +47,7 @@ basic_font = pygame.font.Font('STKAITI.TTF',32)
index = 0
y = 400
jumpState = "runing"
t = 60
t = 300
road_x = 0
bg_x = 0
time = 0
......@@ -88,17 +88,17 @@ while True:
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
t -= 1.5
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 50:
if t <= 300:
y += t
wukong.rect.y = y
t += 2
t += 1.5
else:
jumpState = "runing"
t =50
t =300
# 将背景图画上去
bg_x -= 1
......@@ -129,6 +129,18 @@ while True:
gameover = pygame.image.load('gameover.png') # 游戏结束
screen.blit(gameover, (400, 200))
gamestate = False
if score > one:
conDic["第1名"]=score
conDic["第2名"]=one
conDic["第3名"]=two
elif score > two :
conDic["第2名"]=score
conDic["第3名"]=two
elif score > three :
conDic["第3名"]=score
with open("record.txt" , "w",encoding="utf-8") as f:
txt = json.dumps(conDic , ensure_ascii=True)
f.write(txt)
else:
if sprite.rect.x + sprite.rect.width < wukong.rect.x:
score += sprite.score
......
{"第1名": 0, "第2名": 0, "第3名": 0}
\ No newline at end of file
{"\u7b2c1\u540d": 7, "\u7b2c2\u540d": 4, "\u7b2c3\u540d": 0}
\ 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