public void generatePath(int startx, int starty, int endx, int endy) {
        path.clear();
        open.clear();
        closed.clear();

        if (endx < 0 || endx > Game.WIDTH * Game.SCALE  ||
                endy < 0 || endy > Game.HEIGHT * Game.SCALE )
            return;

        Tile start = level.tiles[startx / Tile.WIDTH][starty / Tile.HEIGHT];
        end = level.tiles[endx / Tile.WIDTH][endy / Tile.HEIGHT];
        Tile current = new Tile(start.x, start.y);

        closed.add(start);

        while (true) {
            if (current.x == end.x && current.y == end.y)
                break;
            searchOpenTiles(current.x, current.y);

            Tile temp = open.remove();
            if (temp == null)
                break;
            closed.add(temp);

            current.x = temp.x;
            current.y = temp.y;

        }

        Tile t = level.tiles[current.x][current.y];
        while ((t = t.getParent()) != null)
            path.add(t);

        level.resetParents();
    }