Mercurial > rinkhals
diff gamelib/engine.py @ 349:a36ab7dd0eb9
Fix 'Are You Sure?' dialog to work at night
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 23:18:27 +0000 |
parents | 6baf8b5beb5c |
children | 25f7d4824250 |
line wrap: on
line diff
--- a/gamelib/engine.py Sat Sep 05 23:17:31 2009 +0000 +++ b/gamelib/engine.py Sat Sep 05 23:18:27 2009 +0000 @@ -186,8 +186,19 @@ sound.background_music("nighttime.ogg") self.game.gameboard.lay_eggs() + self.dialog = None def event(self, e): + if self.dialog and self.dialog.running: + if self.dialog.event(e): + return + elif self.dialog: + if self.dialog.do_quit: + self.dialog = None + self.game.gameboard.reset_states() + return GameOver(self.game) + self.dialog=None + return if events_equal(e, START_DAY): if self.game.gameboard.is_game_over(): return GameOver(self.game) @@ -201,9 +212,7 @@ pygame.time.set_timer(ANIM_ID, self.cycle_time) pygame.time.set_timer(MOVE_FOX_ID, 4*self.cycle_time) elif e.type is KEYDOWN and e.key == K_ESCAPE: - if check_dialog(self.game.main_app): - self.game.gameboard.reset_states() - return GameOver(self.game) + self.dialog = check_exit() elif e.type is ANIM_ID: self.game.gameboard.run_animations() elif e.type is MOVE_FOX_ID: