Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bounce.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-10-02 20:02:57 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-10-02 20:02:57 (GMT)
commitd4ec329376c4cd8f4f460d7c4c9059af4b44e5a6 (patch)
treecc843eeb8ca9a5311e3339ff713baf1f64f1b926 /bounce.py
parente649aede76086773c3b2ba84b44b470983de4024 (diff)
decrease pause between bounces as game progresses
Diffstat (limited to 'bounce.py')
-rw-r--r--bounce.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bounce.py b/bounce.py
index 7ba7753..9e0e69f 100644
--- a/bounce.py
+++ b/bounce.py
@@ -18,6 +18,8 @@ FRACTIONS = [('1/2', 0.5, 12), ('2/8', 0.25, 12), ('1/3', 1 / 3., 12),
('1/6', 1 / 6., 12), ('1/5', 0.2, 10)]
BAR_HEIGHT = 20
STEPS = 100. # number of time steps per bounce rise and fall
+STEP_PAUSE = 50 # milliseconds between steps
+BOUNCE_PAUSE = 3000 # milliseconds between bounces
ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position'
@@ -240,9 +242,11 @@ class Bounce():
self.ball.move((self.ball.get_xy()[0], self.ball_y_max))
self._test()
self.new_bounce = True
- gobject.timeout_add(3000, self._move_ball)
+ gobject.timeout_add( # wait less and less as game goes on
+ max(STEP_PAUSE, BOUNCE_PAUSE - self.count * STEP_PAUSE),
+ self._move_ball)
else:
- gobject.timeout_add(50, self._move_ball)
+ gobject.timeout_add(STEP_PAUSE, self._move_ball)
def _choose_a_fraction(self):
''' Select a new fraction challenge from the table '''