0
我已經用pygame,easygui和shelve在python中製作了一個簡單的賽車遊戲。我完成了遊戲,並且從閒置和從我的.desktop文件中運行都很好。之後,我決定嘗試添加高分系統。該系統在閒置狀態下工作良好,但從.desktop文件中,我收到了一個錯誤「致命的python錯誤:(pygame降落傘)分段錯誤。」我真的想留在遊戲中的排行榜系統,因此任何幫助將是appreciated.`Shelve導致pygame致命錯誤?
if hero.colliderect(finishline):
starttimer=0
running=0
d=shelve.open('highscores.txt')
highscore=d['highscore']
if time<highscore:
d=shelve.open('highscores.txt')
d['highscore']=time
player=easygui.enterbox(msg=("Congratulations you have set the new highscore of "+str(time)+ " please enter your name"))
d['player']=player
d.close
if time>highscore:
d=shelve.open('highscores.txt')
player=d['player']
highscore=d['highscore']
d.close
easygui.msgbox(msg=("Congratulations you have finished with a time of "+str(time)+" The highscore is "+str(highscore)+ "set by "+player))
`
謝謝這麼多即時通訊很高興有這個功能回到我的遊戲。 –