diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-10-01 13:20:09 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-10-01 13:20:09 (GMT) |
commit | 81f161fa97da7dce7a26ab05fe94f909ab5af96e (patch) | |
tree | 112391c9ac78ce810430601d73a6fa0cb467c33f /bounce.py | |
parent | 2e22d4501d72b59f4591ae40ff3e2f56e0135b79 (diff) |
don't update bar until new game starts
Diffstat (limited to 'bounce.py')
-rw-r--r-- | bounce.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -175,6 +175,7 @@ class Bounce(): self.count = 0 self._choose_a_fraction() self.reached_the_top = False + self.new_bounce = True def _gen_bar(self, n): ''' Return a bar with n segments ''' @@ -211,7 +212,10 @@ class Bounce(): def _move_ball(self): """ Move the ball and test boundary conditions """ - self.mark.move((0, self.height)) # hide the mark + if self.new_bounce: + self.mark.move((0, self.height)) # hide the mark + self._choose_a_fraction() + self.new_bounce = False if self.reached_the_top: if self.ball.get_xy()[0] + self.dx > 0 and \ self.ball.get_xy()[0] + self.dx < self.width - self.ball.rect[2]: @@ -232,7 +236,7 @@ class Bounce(): # hit the bottom self._test() self.reached_the_top = False - self._choose_a_fraction() + self.new_bounce = True gobject.timeout_add(3000, self._move_ball) else: gobject.timeout_add(50, self._move_ball) |