Mercurial > rinkhals
comparison gamelib/engine.py @ 229:96d440bebdaa
Non-permenant high score table
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 23:40:13 +0000 |
parents | 527a5d4e3fa3 |
children | d3d5352f5853 |
comparison
equal
deleted
inserted
replaced
228:f74de4280e20 | 229:96d440bebdaa |
---|---|
1 """Game engine and states.""" | 1 """Game engine and states.""" |
2 | |
3 from pgu.engine import Game, State, Quit | 2 from pgu.engine import Game, State, Quit |
4 import pygame | 3 import pygame |
5 from pygame.locals import USEREVENT, QUIT, KEYDOWN, K_ESCAPE, K_n, K_d, K_s, K_i | 4 from pygame.locals import USEREVENT, QUIT, KEYDOWN, K_ESCAPE, K_n, K_d, K_s, K_i |
6 | 5 |
7 import gameboard | 6 import gameboard |
15 def __init__(self, main_app): | 14 def __init__(self, main_app): |
16 self.main_app = main_app | 15 self.main_app = main_app |
17 self.clock = pygame.time.Clock() | 16 self.clock = pygame.time.Clock() |
18 self.main_menu = mainmenu.make_main_menu() | 17 self.main_menu = mainmenu.make_main_menu() |
19 self._open_window = None | 18 self._open_window = None |
19 self.scoreboard = gameover.ScoreTable() | |
20 | 20 |
21 def tick(self): | 21 def tick(self): |
22 """Tic toc.""" | 22 """Tic toc.""" |
23 pygame.time.wait(10) | 23 pygame.time.wait(10) |
24 | 24 |
43 help_screen = helpscreen.make_help_screen() | 43 help_screen = helpscreen.make_help_screen() |
44 self.open_window(help_screen) | 44 self.open_window(help_screen) |
45 | 45 |
46 def create_game_over(self): | 46 def create_game_over(self): |
47 """Create and open the Game Over window""" | 47 """Create and open the Game Over window""" |
48 game_over = gameover.create_game_over(self.gameboard) | 48 game_over = gameover.create_game_over(self.gameboard, self.scoreboard) |
49 self.open_window(game_over) | 49 self.open_window(game_over) |
50 | 50 |
51 class MainMenuState(State): | 51 class MainMenuState(State): |
52 def init(self): | 52 def init(self): |
53 sound.stop_background_music() | 53 sound.stop_background_music() |