Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2008-08-31 18:54:58 (GMT)
committer Daniel Drake <dsd@laptop.org>2008-08-31 18:54:58 (GMT)
commit0a3af3cc2b517e940045b780d84b120918495a70 (patch)
tree354f95b5daa9345b4ca6e3861c257a71d892b715
parent67729dc5eba7dfe9f386530e877f5d0f0cfd5e89 (diff)
make space only create one train
-rw-r--r--bridge.py6
-rw-r--r--tools.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/bridge.py b/bridge.py
index 3857085..a0f3c1c 100644
--- a/bridge.py
+++ b/bridge.py
@@ -11,6 +11,7 @@ class Bridge:
self.capacity = 1
self.first_train = None
self.train_off_screen = False
+ self.train_was_created = False
def create_world(self):
self.world.set_color((100,150,50))
@@ -60,7 +61,10 @@ class Bridge:
print "TRAIN FELL OFF!"
self.train_off_screen = True
- def create_train(self, worldpoint = (-100,490), train = (100, 50), wheelrad = 20, cars = 3):
+ def create_train(self, worldpoint = (-100,490), train = (100, 50), wheelrad = 20, cars = 3, force = False):
+ if not force and self.train_was_created:
+ return
+ self.train_was_created = True
points = []
self.train_off_screen = False
for i in range(0,cars):
diff --git a/tools.py b/tools.py
index 68b2c1e..ac0ee54 100644
--- a/tools.py
+++ b/tools.py
@@ -37,7 +37,7 @@ class Tool(object):
self.game.bridge.create_train()
self.game.world.run_physics = not self.game.world.run_physics
elif event.key == K_t:
- self.game.bridge.create_train()
+ self.game.bridge.create_train(force=True)
elif event.key == K_b:
self.game.setTool("box")
elif event.key == K_c: