Mercurial > pyntnclick
diff gamelib/state.py @ 73:932b0956e77a
Make tools usable.
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Mon, 23 Aug 2010 21:19:34 +0200 |
parents | d2250cf40ee7 |
children | a62db6d10009 |
line wrap: on
line diff
--- a/gamelib/state.py Mon Aug 23 21:08:15 2010 +0200 +++ b/gamelib/state.py Mon Aug 23 21:19:34 2010 +0200 @@ -38,6 +38,8 @@ self.items = {} # list of item objects in inventory self.inventory = [] + # currently selected tool (item) + self.tool = None # Result of the most recent action self.msg = None self.description = None @@ -64,14 +66,17 @@ def remove_inventory_item(self, name): self.inventory.remove(self.items[name]) + def set_tool(self, item): + self.tool = item + def draw(self, surface): self.current_scene.draw(surface) - def interact(self, item, pos): - self.current_scene.interact(item, pos) + def interact(self, pos): + self.current_scene.interact(self.tool, pos) - def mouse_move(self, item, pos): - self.current_scene.mouse_move(item, pos) + def mouse_move(self, pos): + self.current_scene.mouse_move(self.tool, pos) def get_message(self): return self.msg