Mercurial > rinkhals
comparison gamelib/gameboard.py @ 434:f2a55e5e24db
Disable non-selectable toolbar widgets at night
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 17:33:49 +0000 |
parents | 8643893635e7 |
children | feb9b7a23ef2 |
comparison
equal
deleted
inserted
replaced
433:8643893635e7 | 434:f2a55e5e24db |
---|---|
89 | 89 |
90 def create_display(self): | 90 def create_display(self): |
91 width, height = self.disp.rect.w, self.disp.rect.h | 91 width, height = self.disp.rect.w, self.disp.rect.h |
92 tbl = gui.Table() | 92 tbl = gui.Table() |
93 tbl.tr() | 93 tbl.tr() |
94 self.toolbar = toolbar.ToolBar(self, self.level, width=constants.TOOLBAR_WIDTH) | 94 self.toolbar = toolbar.ToolBar(self, width=constants.TOOLBAR_WIDTH) |
95 tbl.td(self.toolbar, valign=-1) | 95 tbl.td(self.toolbar, valign=-1) |
96 self.tvw = VidWidget(self, self.tv, width=width-constants.TOOLBAR_WIDTH, height=height) | 96 self.tvw = VidWidget(self, self.tv, width=width-constants.TOOLBAR_WIDTH, height=height) |
97 tbl.td(self.tvw) | 97 tbl.td(self.tvw) |
98 self.top_widget = tbl | 98 self.top_widget = tbl |
99 | 99 |
140 | 140 |
141 def start_night(self): | 141 def start_night(self): |
142 self.day, self.night = False, True | 142 self.day, self.night = False, True |
143 self.tv.sun(False) | 143 self.tv.sun(False) |
144 self.reset_states() | 144 self.reset_states() |
145 self.toolbar.update_fin_tool(self.day) | 145 self.toolbar.start_night() |
146 self.spawn_foxes() | 146 self.spawn_foxes() |
147 self.eggs = 0 | 147 self.eggs = 0 |
148 for chicken in self.chickens.copy(): | 148 for chicken in self.chickens.copy(): |
149 chicken.start_night(self) | 149 chicken.start_night(self) |
150 self.toolbar.update_egg_counter(self.eggs) | 150 self.toolbar.update_egg_counter(self.eggs) |
152 | 152 |
153 def start_day(self): | 153 def start_day(self): |
154 self.day, self.night = True, False | 154 self.day, self.night = True, False |
155 self.tv.sun(True) | 155 self.tv.sun(True) |
156 self.reset_states() | 156 self.reset_states() |
157 self.toolbar.update_fin_tool(self.day) | 157 self.toolbar.start_day() |
158 self._pos_cache = { 'fox' : [], 'chicken' : []} | 158 self._pos_cache = { 'fox' : [], 'chicken' : []} |
159 self.advance_day() | 159 self.advance_day() |
160 self.clear_foxes() | 160 self.clear_foxes() |
161 for chicken in self.chickens.copy(): | 161 for chicken in self.chickens.copy(): |
162 chicken.start_day(self) | 162 chicken.start_day(self) |
565 self.foxes = set() # Remove all the foxes | 565 self.foxes = set() # Remove all the foxes |
566 | 566 |
567 def clear_chickens(self): | 567 def clear_chickens(self): |
568 for chicken in self.chickens.copy(): | 568 for chicken in self.chickens.copy(): |
569 self.remove_chicken(chicken) | 569 self.remove_chicken(chicken) |
570 | |
571 def run_animations(self): | |
572 # For legacy. | |
573 if self.toolbar.anim_clear_tool: | |
574 self.toolbar.clear_tool() | |
575 | 570 |
576 def do_night_step(self): | 571 def do_night_step(self): |
577 """Handle the events of the night. | 572 """Handle the events of the night. |
578 | 573 |
579 We return True if there are no more foxes to move or all the | 574 We return True if there are no more foxes to move or all the |