From 5284e89a7e0d3cf794d435bed6cfa4926e95d55a Mon Sep 17 00:00:00 2001 From: Brian Jordan Date: Fri, 10 Jul 2009 13:49:43 +0000 Subject: Make destroy tool unpin an object (Trac #990) --- diff --git a/tools.py b/tools.py index 44d96ef..1b20da9 100644 --- a/tools.py +++ b/tools.py @@ -402,11 +402,15 @@ class DestroyTool(Tool): self.vertices.append(pygame.mouse.get_pos()) if len(self.vertices) > 10: self.vertices.pop(0) + tokill = self.game.world.get_bodies_at_pos(pygame.mouse.get_pos()) - #self.game.world.world.DestroyJoint( - #jointlist = tokill[0].GetJointList() - #print jointlist.joint + if tokill: + jointnode = tokill[0].GetJointList() + if jointnode: + joint = jointnode.joint + self.game.world.world.DestroyJoint(joint) + else: self.game.world.world.DestroyBody(tokill[0]) elif event.type == MOUSEBUTTONUP and event.button == 1: self.cancel() -- cgit v0.9.1