comparison gamelib/engine.py @ 254:f399e4926c36

Fix events getting sent to the gameboard
author Neil Muller <drnlmuller@gmail.com>
date Sat, 05 Sep 2009 12:44:53 +0000
parents 634491bf37e8
children d508248041ff
comparison
equal deleted inserted replaced
253:9c5d2cb3f114 254:f399e4926c36
15 self.main_app = main_app 15 self.main_app = main_app
16 self.clock = pygame.time.Clock() 16 self.clock = pygame.time.Clock()
17 self.main_menu = mainmenu.make_main_menu() 17 self.main_menu = mainmenu.make_main_menu()
18 self._open_window = None 18 self._open_window = None
19 self.scoreboard = gameover.ScoreTable() 19 self.scoreboard = gameover.ScoreTable()
20 self.gameboard = None
20 21
21 def tick(self): 22 def tick(self):
22 """Tic toc.""" 23 """Tic toc."""
23 pygame.time.wait(10) 24 pygame.time.wait(10)
24 25
44 self.open_window(help_screen) 45 self.open_window(help_screen)
45 46
46 def create_game_over(self): 47 def create_game_over(self):
47 """Create and open the Game Over window""" 48 """Create and open the Game Over window"""
48 game_over = gameover.create_game_over(self.gameboard, self.scoreboard) 49 game_over = gameover.create_game_over(self.gameboard, self.scoreboard)
50 self.gameboard = None
49 self.open_window(game_over) 51 self.open_window(game_over)
52
53 def event(self, e):
54 if not Game.event(self, e) and self.gameboard:
55 self.gameboard.event(e)
56
50 57
51 class MainMenuState(State): 58 class MainMenuState(State):
52 def init(self): 59 def init(self):
53 sound.stop_background_music() 60 sound.stop_background_music()
54 self.game.set_main_menu() 61 self.game.set_main_menu()