Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2012-05-30 21:21:44 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-05-30 21:21:44 (GMT)
commit8cdd216e6dd8cd8b539b842de9dda889560fe54e (patch)
tree2eb2892e5a34a220e972d4939dfc6514e5f0c87d
parent1da1abfa6df5557a94a7e9b4539aaa4f2c4fd605 (diff)
Restart when the ball falls outside the ground
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rwxr-xr-xgame.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/game.py b/game.py
index 5f2289a..d239014 100755
--- a/game.py
+++ b/game.py
@@ -118,10 +118,14 @@ class TiltGame(object):
# Move the ball
if not self._paused:
if self.level.is_on_hole(self.ball.get_position()):
+ # Success! Restart
self.ball.set_position(*self.level.get_ball_start())
if self.level.is_on_ground(self.ball.get_position()):
self.ball.update()
+ else:
+ # Fail! Restart
+ self.ball.set_position(*self.level.get_ball_start())
# Clear Display
self._screen.fill(BACKGROUND_COLOR)