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-06 01:20:23 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-10-06 01:20:23 (GMT)
commit6be4e8515daed50fa2d18336c70ccffbe8ea39c7 (patch)
treee6358a6d57a392bcd99131d1684d151b4ac0dede /bounce.py
parent13075d72852c0eb931ede7dc3e92f85346b93e77 (diff)
speed up horizontal movement if key is held down
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 19e39f9..84c4a7c 100644
--- a/bounce.py
+++ b/bounce.py
@@ -295,10 +295,14 @@ class Bounce():
if self.ball.get_xy()[0] + self.dx > 0 and \
self.ball.get_xy()[0] + self.dx < self.width - self.ball.rect[2]:
- self.ball.move_relative((self.dx, self.dy))
+ self.ball.move_relative((int(self.dx), int(self.dy)))
else:
- self.ball.move_relative((0, self.dy))
+ self.ball.move_relative((0, int(self.dy)))
+ # speed up ball in x while key is pressed
+ self.dx *= 1.05
+
+ # accelerate in y
self.dy += self.ddy
if self.ball.get_xy()[1] >= self.ball_y_max: