comparison gamelib/engine.py @ 203:653da96db572

Fixed dangling cursor sprite and did some TODO list maintenance.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 04 Sep 2009 20:25:32 +0000
parents 3074784c93f4
children 07b361ebd87f
comparison
equal deleted inserted replaced
202:3074784c93f4 203:653da96db572
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.reset_cursor() 123 self.game.gameboard.set_cursor()
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.reset_cursor() 151 self.game.gameboard.set_cursor()
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)
166 return GameOver(self.game) 166 return GameOver(self.game)
167 return DayState(self.game) 167 return DayState(self.game)
168 elif e.type is KEYDOWN and e.key == K_d: 168 elif e.type is KEYDOWN and e.key == K_d:
169 return pygame.event.post(START_DAY) 169 return pygame.event.post(START_DAY)
170 elif e.type is KEYDOWN and e.key == K_ESCAPE: 170 elif e.type is KEYDOWN and e.key == K_ESCAPE:
171 self.game.gameboard.reset_cursor() 171 self.game.gameboard.set_cursor()
172 return GameOver(self.game) 172 return GameOver(self.game)
173 elif e.type is ANIM_ID: 173 elif e.type is ANIM_ID:
174 self.game.gameboard.run_animations() 174 self.game.gameboard.run_animations()
175 elif e.type is MOVE_FOX_ID: 175 elif e.type is MOVE_FOX_ID:
176 self.cycle_count += 1 176 self.cycle_count += 1