From 901a8a638a92b2138b6ce27dd7e90b3b3b4d1833 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Sun, 31 Aug 2008 00:13:09 +0000 Subject: add concept of cost --- (limited to 'bridge.py') diff --git a/bridge.py b/bridge.py index 62a0f76..e254340 100644 --- a/bridge.py +++ b/bridge.py @@ -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: -- cgit v0.9.1