Mercurial > rinkhals
comparison gamelib/engine.py @ 30:2eec29085060
Color night and day.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 18:51:28 +0000 |
parents | 2e88c680672c |
children | 3c4db7bba432 |
comparison
equal
deleted
inserted
replaced
29:2e88c680672c | 30:2eec29085060 |
---|---|
41 pygame.display.update(update) | 41 pygame.display.update(update) |
42 | 42 |
43 class DayState(State): | 43 class DayState(State): |
44 def init(self): | 44 def init(self): |
45 """Add some chickens to the farm""" | 45 """Add some chickens to the farm""" |
46 self.game.gameboard.tv.sun(True) | |
47 | |
46 # disable timer | 48 # disable timer |
47 pygame.time.set_timer(MOVE_FOX_ID, 0) | 49 pygame.time.set_timer(MOVE_FOX_ID, 0) |
48 # Very simple, we walk around the tilemap, and, for each farm tile, | 50 # Very simple, we walk around the tilemap, and, for each farm tile, |
49 # we randomly add a chicken (1 in 10 chance) until we have 5 chickens | 51 # we randomly add a chicken (1 in 10 chance) until we have 5 chickens |
50 # or we run out of board | 52 # or we run out of board |
108 self.game.gameboard.loop() | 110 self.game.gameboard.loop() |
109 | 111 |
110 class NightState(State): | 112 class NightState(State): |
111 def init(self): | 113 def init(self): |
112 """Add some foxes to the farm""" | 114 """Add some foxes to the farm""" |
115 self.game.gameboard.tv.sun(False) | |
116 | |
113 # Add a timer to the event queue | 117 # Add a timer to the event queue |
114 self.cycle_count = 0 | 118 self.cycle_count = 0 |
115 pygame.time.set_timer(MOVE_FOX_ID, 300) | 119 pygame.time.set_timer(MOVE_FOX_ID, 300) |
116 # Very simple, we walk around the tilemap, and, for each farm tile, | 120 # Very simple, we walk around the tilemap, and, for each farm tile, |
117 # we randomly add a chicken (1 in 10 chance) until we have 5 chickens | 121 # we randomly add a chicken (1 in 10 chance) until we have 5 chickens |