Mercurial > rinkhals
comparison gamelib/engine.py @ 213:07b361ebd87f
Ensure we clean up highlights, etc.
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 21:49:32 +0000 |
parents | 653da96db572 |
children | 322e6d3a46e4 |
comparison
equal
deleted
inserted
replaced
212:b999abd5993b | 213:07b361ebd87f |
---|---|
118 | 118 |
119 def event(self, e): | 119 def event(self, e): |
120 if events_equal(e, START_NIGHT): | 120 if events_equal(e, START_NIGHT): |
121 return NightState(self.game) | 121 return NightState(self.game) |
122 elif e.type is KEYDOWN and e.key == K_ESCAPE: | 122 elif e.type is KEYDOWN and e.key == K_ESCAPE: |
123 self.game.gameboard.set_cursor() | 123 self.game.gameboard.reset_states() |
124 return GameOver(self.game) | 124 return GameOver(self.game) |
125 elif e.type is ANIM_ID: | 125 elif e.type is ANIM_ID: |
126 self.game.gameboard.run_animations() | 126 self.game.gameboard.run_animations() |
127 elif e.type is KEYDOWN and e.key == K_n: | 127 elif e.type is KEYDOWN and e.key == K_n: |
128 return pygame.event.post(START_NIGHT) | 128 return pygame.event.post(START_NIGHT) |
146 class NightState(State): | 146 class NightState(State): |
147 def init(self): | 147 def init(self): |
148 """Add some foxes to the farm""" | 148 """Add some foxes to the farm""" |
149 sound.stop_background_music() | 149 sound.stop_background_music() |
150 self.game.gameboard.tv.sun(False) | 150 self.game.gameboard.tv.sun(False) |
151 self.game.gameboard.set_cursor() | 151 self.game.gameboard.reset_states() |
152 | 152 |
153 sound.play_sound("nightfall.ogg") | 153 sound.play_sound("nightfall.ogg") |
154 # Add a timer to the event queue | 154 # Add a timer to the event queue |
155 self.cycle_count = 0 | 155 self.cycle_count = 0 |
156 pygame.time.set_timer(MOVE_FOX_ID, 200) | 156 pygame.time.set_timer(MOVE_FOX_ID, 200) |