comparison gamelib/engine.py @ 116:d539ef5a3333

Add basic chicken->egg cycle
author Neil Muller <drnlmuller@gmail.com>
date Wed, 02 Sep 2009 20:04:47 +0000
parents f5d56688943b
children 2c76ed47fc44
comparison
equal deleted inserted replaced
115:2b2007e231da 116:d539ef5a3333
52 # disable timer 52 # disable timer
53 pygame.time.set_timer(MOVE_FOX_ID, 0) 53 pygame.time.set_timer(MOVE_FOX_ID, 0)
54 self.game.gameboard.clear_foxes() 54 self.game.gameboard.clear_foxes()
55 self.game.gameboard.update_chickens() 55 self.game.gameboard.update_chickens()
56 sound.background_music("daytime.ogg") 56 sound.background_music("daytime.ogg")
57 self.game.gameboard.hatch_eggs()
57 58
58 def event(self, e): 59 def event(self, e):
59 if events_equal(e, START_NIGHT): 60 if events_equal(e, START_NIGHT):
60 return NightState(self.game) 61 return NightState(self.game)
61 elif e.type is KEYDOWN and e.key == K_ESCAPE: 62 elif e.type is KEYDOWN and e.key == K_ESCAPE:
88 # Add a timer to the event queue 89 # Add a timer to the event queue
89 self.cycle_count = 0 90 self.cycle_count = 0
90 pygame.time.set_timer(MOVE_FOX_ID, 200) 91 pygame.time.set_timer(MOVE_FOX_ID, 200)
91 self.game.gameboard.spawn_foxes() 92 self.game.gameboard.spawn_foxes()
92 sound.background_music("nighttime.ogg") 93 sound.background_music("nighttime.ogg")
94
95 self.game.gameboard.lay_eggs()
93 96
94 def event(self, e): 97 def event(self, e):
95 if events_equal(e, START_DAY): 98 if events_equal(e, START_DAY):
96 return DayState(self.game) 99 return DayState(self.game)
97 elif e.type is KEYDOWN and e.key == K_d: 100 elif e.type is KEYDOWN and e.key == K_d: