PathFinding.js
PathFinding.js copied to clipboard
Followed instructions and basic usage, nothing happens.
Hello,
I've followed the instructions and ended up with some code looking like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/pathfinding/pathfinding-browser.min.js"></script>
</head>
<body>
</body>
<script>
//Walkability matrix. Zero is walkable, One is not
var matrix = [
[0, 0, 0, 1, 0],
[1, 0, 0, 0, 1],
[0, 0, 1, 0, 0],
];
var grid = new PF.Grid(matrix);
var finder = new PF.AStarFinder();
var path = finder.findPath(1, 2, 4, 2, grid);
</script>
</html>
Nothing at all is drawn. What am I missing here?
This is a pathfinding library, it will not draw anything. You'll have to use some other means to draw whatever you want.