From: Neil Date: Sat, 20 Apr 2013 09:34:31 +0000 (+0200) Subject: Don't be as stict when deciding if the player has pressed on the correct sprite ... X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=902dc730258c6303339c105e49eb62499598de0e;p=erdslangetjie.git Don't be as stict when deciding if the player has pressed on the correct sprite - should make android play easier --- diff --git a/erdslangetjie/__main__.py b/erdslangetjie/__main__.py index 8121eb9..4805419 100644 --- a/erdslangetjie/__main__.py +++ b/erdslangetjie/__main__.py @@ -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