diff options
-rw-r--r-- | bridge.py | 6 | ||||
-rw-r--r-- | tools.py | 2 |
2 files changed, 8 insertions, 0 deletions
@@ -15,6 +15,12 @@ class Bridge: self.level_completed = False self.sounds = {"wooo":loadSound("sounds/wooo.wav"), "death":loadSound("sounds/death.wav"), "startup":loadSound("sounds/startup.wav")} + def restart(self): + self.world.run_physics = False + self.train_off_screen = False + self.level_completed = False + self.train_was_created = False + def create_world(self): self.world.set_color((100,150,50)) rect = pygame.Rect((-400,800), (750, -250)) @@ -36,6 +36,8 @@ class Tool(object): #space pauses self.game.bridge.create_train() self.game.world.run_physics = not self.game.world.run_physics + elif event.key == K_r: + self.game.bridge.restart() elif event.key == K_t: self.game.bridge.create_train(force=True) elif event.key == K_b: |