Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--physics.py1
-rw-r--r--tools.py7
2 files changed, 4 insertions, 4 deletions
diff --git a/physics.py b/physics.py
index 79f4c3c..706f0d5 100644
--- a/physics.py
+++ b/physics.py
@@ -80,7 +80,6 @@ class PhysicsGame:
def setTool(self,tool):
self.currentTool.cancel()
- self.currentTool = self.tools[tool]
self.currentTool = self.tools[tool]
def main():
diff --git a/tools.py b/tools.py
index 7f3ef64..c20fdb8 100644
--- a/tools.py
+++ b/tools.py
@@ -36,9 +36,10 @@ class Tool(object):
self.game.setTool("destroy")
elif event.key == K_m:
self.game.setTool("magicpen")
- elif event.type == USEREVENT:
- # for switching tools
- self.game.setTool(event.action)
+ elif event.type == USEREVENT:
+ if hasattr(event,"action"):
+ if self.game.tools.has_key(event.action): self.game.setTool(event.action)
+
else:
# let the subclasses know that no events were handled yet
return False