This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AStar | |
* | |
* Created by Paul Armstrong on 2011-05-26. | |
* Copyright (c) 2011 Paul Armstrong Designs. All rights reserved. | |
* | |
* Based on: https://gist.github.com/827899 | |
*/ | |
ig.module('plugins.a-star') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A* path finding algorithm for impactjs game engine | |
// adapted from http://stormhorse.com/a_star.js | |
// via http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html | |
// impact-ified by jminor - http://pixelverse.org/ | |
/* Example: | |
this.pathFinder = new PathFinder(); | |
var start = [((this.pos.x+this.size.x/2) / tilesize).floor(), ((this.pos.y+this.size.y/2) / tilesize).floor()]; | |
var destination = [((target.pos.x+target.size.x/2) / tilesize).floor(), ((target.pos.y+target.size.y/2) / tilesize).floor()]; |
NewerOlder