diff options
author | Manuel 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) |
commit | 8cdd216e6dd8cd8b539b842de9dda889560fe54e (patch) | |
tree | 2eb2892e5a34a220e972d4939dfc6514e5f0c87d | |
parent | 1da1abfa6df5557a94a7e9b4539aaa4f2c4fd605 (diff) |
Restart when the ball falls outside the ground
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rwxr-xr-x | game.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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) |