diff skaapsteker/sprites/player.py @ 148:0474df61d5b1

Clamp very slow horizontal motion
author Neil Muller <drnlmuller@gmail.com>
date Tue, 05 Apr 2011 17:13:32 +0200
parents 887d69907b22
children 5b4d73d301a1
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py	Tue Apr 05 17:05:13 2011 +0200
+++ b/skaapsteker/sprites/player.py	Tue Apr 05 17:13:32 2011 +0200
@@ -53,7 +53,9 @@
     def update(self):
         v_x, v_y = self.velocity
         self._animation_frame += abs(v_x) / 3000.0
-        if v_x == 0:
+        if abs(v_x) < 10:
+            # Clamp when we're not moving at least 5 pixel / s
+            self.velocity = (0, v_y)
             self.running = False
         else:
             self.running = True