UNPKG

roguelike-pumpkin-patch

Version:
27 lines (26 loc) 1.06 kB
/** Function to check if a tile is passable */ declare type canPass = (position: Array<number>) => boolean; /** Function to guess at approximate distance to target */ declare type metric = (position1: Array<number>, position2: Array<number>) => number; /** Function to get the weight of each step i.e. if some things are harder to move through */ declare type weight = (position: Array<number>) => number; interface PathFinderParams { canPass: canPass; metric?: metric; maxIterations?: number; weight?: weight; } /** Pathfinder to determine how to travel from one point to another */ export default class PathFinder { private canPass; private metric; private maxIterations; private weight; constructor(parameters: PathFinderParams); /** Find route from startPosition to endPosition, via A* */ findPath(startPosition: Array<number>, endPosition: Array<number>, orthogonalOnly?: boolean): Array<Array<number>>; private isEqual; private contains; private getLocation; } export {};