Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bernabé <laurent.bernabe@gmail.com>2013-09-21 07:19:49 (GMT)
committer Laurent Bernabé <laurent.bernabe@gmail.com>2013-09-21 07:19:49 (GMT)
commit27ad681101acab42a52a3f817343c82bdcb88d28 (patch)
tree0feba2ef7d0ff50d1289a9e3031850d147417afc
parent24bccf02797828525c181d827654b2f0ebd67cff (diff)
Countdown time bar animation is smoother.
-rw-r--r--main.py2
-rw-r--r--time_bar.py7
2 files changed, 5 insertions, 4 deletions
diff --git a/main.py b/main.py
index 488f086..2f75621 100644
--- a/main.py
+++ b/main.py
@@ -56,7 +56,7 @@ def main():
the_balls[3].move_to((330, 70))
time_bar = TimeBar(size[0], TIME_BAR_HEIGHT, DARK_GREEN, GRAY)
- time_bar.start(1000, 10)
+ time_bar.start(1000, 1)
while True:
screen.fill(BACKGROUND)
diff --git a/time_bar.py b/time_bar.py
index a228153..184d9f0 100644
--- a/time_bar.py
+++ b/time_bar.py
@@ -33,8 +33,9 @@ class TimeBar(object):
def start(self, max_value, step):
"""
Starts a new 'session'. Please, notice that time between two stages
- (or ticks) is 100 milliseconds, and that you must call decrease()
- method on USEREVENT+1 event of pygame.
+ (or ticks) is 10 milliseconds (so it will take max_value * step * 10
+ milleseconds for the bar to be empty), and that you must call
+ decrease() method on USEREVENT+1 event of pygame.
max_value : the start value (don't forget that it is a reversed
progress bar) => integer
step : how many units will be removed at each stage => integer
@@ -42,7 +43,7 @@ class TimeBar(object):
self._value = max_value
self._max_value = max_value
self._step = step
- pygame.time.set_timer(USEREVENT + 1, 100)
+ pygame.time.set_timer(USEREVENT + 1, 10)
def decrease(self):
"""