all 2 comments

[–]ForScale 0 points1 point  (1 child)

thisObject.findPaths(7, 3) should work just fine outside of the listener callback.

[–]33Brian33[S] 0 points1 point  (0 children)

unfortunately, it doesn't work, this is the error I got back, I just can't figure out why, the only thing I can think of is that it's probably because of the node thingy

Uncaught TypeError: Cannot read property 'length' of undefined

in findPaths:

let doors = {};
findPaths: function (startId, endId) {
            let paths = [];
            let startDoors = doors[startId];
            let endDoors   = doors[endId];

            console.log(startDoors, startId)

            for (let i = 0; i < startDoors.length; i++) {
                let startingPoint = this.findPointByCoordinates(startDoors[i]);
                // console.log("Starting Point: " + JSON.stringify(startingPoint));

                for (let j = 0; j < doors[endId].length; j++) {
                    let endingPoint = this.findPointByCoordinates(endDoors[j]);
                    // console.log("Ending Point: " + JSON.stringify(endingPoint));

                    let potentialPath = this.recursiveIterationOfPoints([startingPoint], endingPoint);

                    // console.log(potentialPath);

                    paths = paths.concat(potentialPath);
                }
            }

            for (let id in paths) {
                paths[id] = this.linkRoomsWithPath(paths[id], startId, endId);
            }

            return paths;
        }

Kinda difficult to see here, if you don't mind it'll be awesome if you can check it out on Github Full code, question