diff options
author | Daniel Drake <dsd@laptop.org> | 2008-08-30 22:49:32 (GMT) |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2008-08-30 22:49:32 (GMT) |
commit | 233d543dab3f0a656d1e34ed306a08ffcee85c73 (patch) | |
tree | 173f7dfe41e0e68e5ed5c30401a9ae0847a0a055 /bridge.py | |
parent | f837fb6f1d40087a3686d2e22c70e05be02e58f3 (diff) |
destroy joints when excess force is applied
Diffstat (limited to 'bridge.py')
-rw-r--r-- | bridge.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -5,6 +5,7 @@ class Bridge: self.game = game self.screen = game.screen self.world = game.world + self.joints = [] def create_world(self): rect = pygame.Rect((0,800), (350, -250)) @@ -20,4 +21,13 @@ class Bridge: def joint_added(self, joint): print "joint added!" + self.joints.append(joint) + + def for_each_frame(self): + for joint in self.joints: + force = joint.GetReactionForce().Length() + if force > 500: + print "destroy joint!" + self.world.world.DestroyJoint(joint) + self.joints.remove(joint) |