diff options
Diffstat (limited to 'tools.py')
-rw-r--r-- | tools.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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": |