diff options
author | Daniel Drake <dsd@laptop.org> | 2008-08-31 00:13:09 (GMT) |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2008-08-31 00:13:09 (GMT) |
commit | 901a8a638a92b2138b6ce27dd7e90b3b3b4d1833 (patch) | |
tree | b27c9504dd356c61ee4902413c09ceb22126c2ad /bridge.py | |
parent | 233d543dab3f0a656d1e34ed306a08ffcee85c73 (diff) |
add concept of cost
Diffstat (limited to 'bridge.py')
-rw-r--r-- | bridge.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -6,6 +6,7 @@ class Bridge: self.screen = game.screen self.world = game.world self.joints = [] + self.cost = 0 def create_world(self): rect = pygame.Rect((0,800), (350, -250)) @@ -19,9 +20,17 @@ class Bridge: self.world.add.rect(rect.center, rect.width / 2, rect.height / 2, dynamic=False) + def add_cost(self, value): + self.cost = self.cost + value + print "cost now", value + def joint_added(self, joint): print "joint added!" self.joints.append(joint) + self.add_cost(100) + + def box_added(self): + self.add_cost(10) def for_each_frame(self): for joint in self.joints: |