Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/physics.py
diff options
context:
space:
mode:
authornrp <olpc@spongezone.net>2008-08-31 00:09:49 (GMT)
committer nrp <olpc@spongezone.net>2008-08-31 00:09:49 (GMT)
commit2b6538ccc1fb8c88da17beafbc0f9f4651f721f2 (patch)
tree6f280811782eaa4d2dc36a33f220fa324152b018 /physics.py
parent94ee6292b6213d14634006769bbd2f6b90ea4ea4 (diff)
parent901a8a638a92b2138b6ce27dd7e90b3b3b4d1833 (diff)
Merge branch 'master' of git://dev.laptop.org/projects/physics03
Conflicts: physics.py tools.py
Diffstat (limited to 'physics.py')
-rw-r--r--physics.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/physics.py b/physics.py
index f2e38f5..e0afdf4 100644
--- a/physics.py
+++ b/physics.py
@@ -23,7 +23,7 @@ import olpcgames
import elements
from elements import Elements
import tools
-import bridge
+from bridge import Bridge
from helpers import *
class PhysicsGame:
@@ -35,6 +35,7 @@ class PhysicsGame:
self.canvas = olpcgames.ACTIVITY.canvas
self.joystickobject = None
self.debug = True
+
# create the name --> instance map for components
self.toolList = {}
for c in tools.allTools:
@@ -48,8 +49,9 @@ class PhysicsGame:
# set up static environment
self.world.add.ground()
- bridge.create_world(self)
- bridge.create_train(self)
+ self.bridge = Bridge(self)
+ self.bridge.create_world()
+ self.bridge.create_train()
def run(self):
self.running = True
@@ -63,6 +65,9 @@ class PhysicsGame:
self.currentTool.handleEvents(event)
# Clear Display
self.screen.fill((255,255,255)) #255 for white
+
+ if self.world.run_physics:
+ self.bridge.for_each_frame()
# Update & Draw World
self.world.update()
@@ -72,9 +77,10 @@ class PhysicsGame:
self.currentTool.draw()
#Print all the text on the screen
- text = self.font.render("Current Tool: "+self.currentTool.name, True, (255,255,255))
+ text = self.font.render("Total Cost: %d" % self.bridge.cost, True, (0,0,0))
textpos = text.get_rect(left=700,top=7)
self.screen.blit(text,textpos)
+
# Flip Display
pygame.display.flip()