Mercurial > rinkhals
diff gamelib/gameboard.py @ 223:527a5d4e3fa3
Disable tools at night.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 22:39:19 +0000 |
parents | d46ae64240a1 |
children | c279ad59b8e2 |
line wrap: on
line diff
--- a/gamelib/gameboard.py Fri Sep 04 22:38:48 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 22:39:19 2009 +0000 @@ -223,6 +223,7 @@ self.days = 0 self.killed_foxes = 0 self.add_cash(constants.STARTING_CASH) + self.day, self.night = True, False self.fix_buildings() @@ -248,6 +249,8 @@ self.tv.loop() def set_selected_tool(self, tool, cursor): + if not self.day: + return self.selected_tool = tool if self.animal_to_place: # Clear any highlights @@ -276,6 +279,16 @@ tile_pos = self.tv.screen_to_tile(e.pos) self.sprite_cursor.set_pos(tile_pos) + def start_night(self): + self.day, self.night = False, True + self.tv.sun(False) + self.reset_states() + + def start_day(self): + self.day, self.night = True, False + self.tv.sun(True) + self.reset_states() + def in_bounds(self, pos): """Check if a position is within the game boundaries""" if pos.x < 0 or pos.y < 0: @@ -286,6 +299,8 @@ return True def use_tool(self, e): + if not self.day: + return if e.button == 3: # Right button self.selected_tool = None self.set_cursor()