Changeset 131:4527e09dc620


Ignore:
Timestamp:
Sep 2, 2009, 9:52:52 PM (11 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@132
Message:

Add lumberjacks.

Location:
gamelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gamelib/constants.py

    r105 r131  
    3030SELL_PRICE_CHICKEN = 10
    3131SELL_PRICE_DEAD_FOX = 5
     32LOGGING_PRICE = 50
    3233BUY_PRICE_FENCE = 50
    3334SELL_PRICE_FENCE = 25
     
    3940TOOL_BUY_FENCE = 4
    4041TOOL_PLACE_ANIMALS = 5
     42TOOL_LOGGING = 6
  • gamelib/gameboard.py

    r128 r131  
    5252        self.add_tool_button("Sell egg", constants.TOOL_SELL_EGG)
    5353        self.add_tool_button("Sell building", constants.TOOL_SELL_BUILDING)
     54        self.add_tool_button("Lumberjack", constants.TOOL_LOGGING)
    5455        self.add_tool_button("Buy fence", constants.TOOL_BUY_FENCE)
    5556        for building_cls in buildings.BUILDINGS:
     
    194195        elif self.selected_tool == constants.TOOL_SELL_BUILDING:
    195196            self.sell_building(self.tv.screen_to_tile(e.pos))
     197        elif self.selected_tool == constants.TOOL_LOGGING:
     198            self.logging_forest(self.tv.screen_to_tile(e.pos))
    196199        elif buildings.is_building(self.selected_tool):
    197200            self.buy_building(self.tv.screen_to_tile(e.pos), self.selected_tool)
     
    343346            return
    344347        self.add_cash(constants.SELL_PRICE_FENCE)
     348        self.tv.set(tile_pos, self.GRASSLAND)
     349
     350    def logging_forest(self, tile_pos):
     351        if self.tv.get(tile_pos) != self.WOODLAND:
     352            return
     353        self.add_cash(-constants.LOGGING_PRICE)
    345354        self.tv.set(tile_pos, self.GRASSLAND)
    346355
Note: See TracChangeset for help on using the changeset viewer.