Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools.py b/tools.py
index 358e1fe..62aba05 100644
--- a/tools.py
+++ b/tools.py
@@ -49,6 +49,14 @@ class Tool(object):
# Stop/start simulation
toggle = self.game.world.run_physics
self.game.world.run_physics = not toggle
+ elif event.action == "clear_all":
+ if len(self.game.world.world.GetBodyList()) > 1:
+ # Get bodies and destroy them too
+ for body in self.game.world.world.GetBodyList():
+ self.game.world.world.DestroyBody(body)
+
+ # Add ground, because we destroyed it before
+ self.game.world.add.ground()
elif event.action == "focus_in":
self.game.in_focus = True
elif event.action == "focus_out":