Don't be as stict when deciding if the player has pressed on the correct sprite ...
authorNeil <neil@dip.sun.ac.za>
Sat, 20 Apr 2013 09:34:31 +0000 (11:34 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 20 Apr 2013 09:34:31 +0000 (11:34 +0200)
erdslangetjie/__main__.py

index 8121eb92436228066feaae21e2d6de4962ac6582..48054197543eb14059ffadfe796ab5604102430a 100644 (file)
@@ -286,9 +286,13 @@ class GameWindow(RelativeLayout):
         pos = self.to_local(*pos)
         return (int(pos[0] / TILE_SIZE), int(pos[1] / TILE_SIZE))
 
+    def _near_player(self, pos):
+        return (abs(pos[0] - self.player.pos[0]) < 2 and
+                abs(pos[1] - self.player.pos[1]) < 2)
+
     def on_touch_down(self, touch):
         pos = self._calc_mouse_pos(touch.pos)
-        if pos == self.player.pos:
+        if self._near_player(pos):
             self.mouse_move = True
             self.mouse_start = pos