Mercurial > fife-parpg
diff demos/shooter/scripts/world.py @ 468:ebbb420a90b9
Fix the bug where the high score dialog box causes a crash after the player completes the level.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 14 Apr 2010 16:35:07 +0000 |
parents | 4d0aa75a82f1 |
children | 5994e61cdebd |
line wrap: on
line diff
--- a/demos/shooter/scripts/world.py Wed Apr 14 16:22:36 2010 +0000 +++ b/demos/shooter/scripts/world.py Wed Apr 14 16:35:07 2010 +0000 @@ -205,23 +205,22 @@ self._highscores.show() def endLevel(self): - #there is only one level so do the high score display self._paused = True + self._sceneended = True + def showHighScoreDialog(self): + self._sceneended = False + if self._highscores.isHighScore(self.scene.player.score): score = self.scene.player.score - #self.reset() dlg = pychan.loadXML('gui/highscoredialog.xml') dlg.execute({ 'okay' : "Yay!" }) name = dlg.findChild(name='name').text - #self._highscores.addHighScore(HighScore(name, score)) - #self._highscores.show() - - self._sceneended = True - - + self._highscores.addHighScore(HighScore(name, score)) + self._highscores.show() + def newGame(self): self.loadLevel("maps/shooter_map1.xml") @@ -302,8 +301,8 @@ """ if self._sceneended: + self.showHighScoreDialog() self.reset() - self.showMainMenu() if self._genericrenderer: self._genericrenderer.removeAll("quads")