while (x >= 0 && $game.$map.currentTiles[x][y].tileState === 0) {
          targetPosition = { x: x, y: y }
          x--
        }