diff options
author | Kshitij Kumar <kshitijakumar@gmail.com> | 2013-01-07 14:41:13 (GMT) |
---|---|---|
committer | Kshitij Kumar <kshitijakumar@gmail.com> | 2013-01-07 14:41:13 (GMT) |
commit | db1083c3b39dcfdd98e40be57f1e795b20a219d1 (patch) | |
tree | 8c6388c3ba85fef797cd31743a3bd846babad813 | |
parent | cbad12f7154a40fcce8c3be1b696cd2cf4904078 (diff) |
game.py fixes
-rw-r--r-- | game.py | 29 |
1 files changed, 4 insertions, 25 deletions
@@ -80,7 +80,7 @@ class MazeGame: GOAL_COLOR = (0x00, 0xff, 0x00) WIN_COLOR = (0xff, 0xff, 0x00) - def __init__(self, screen): + def __init__(self, activity): # note what time it was when we first launched self.game_start_time = time.time() @@ -427,30 +427,9 @@ class MazeGame: return False def run(self): - """Run the main loop of the game.""" - # lets draw once before we enter the event loop - - clock = pygame.time.Clock() - pygame.display.flip() - - while self.running: - clock.tick(25) - a, b, c, d = pygame.cursors.load_xbm('my_cursor.xbm', - 'my_cursor_mask.xbm') - pygame.mouse.set_cursor(a, b, c, d) - self.frame += 1 - # process all queued events - for event in pausescreen.get_events(sleep_timeout=30): - self.processEvent(event) - - self.animate() - self.draw() - - pygame.display.update() - # don't animate faster than about 20 frames per second - # this keeps the speed reasonable and limits cpu usage - clock.tick(25) - + self.screen = pygame.display.get_surface() + pygame.display.init() + def harder(self): """Make a new maze that is harder than the current one.""" # both width and height must be odd |