Method: generate

Uses the A* algorithm to generate path data between two points.
generate (IgeCollisionMap2d tileMap, IgePoint3d startPoint, IgePoint3d endPoint, Function comparisonCallback, Boolean allowSquare, Boolean allowDiagonal, Boolean allowInvalidDestination)
  • IgeCollisionMap2dtileMap The tile map to use when generating the path.
  • IgePoint3dstartPoint The point on the map to start path-finding from.
  • IgePoint3dendPoint The point on the map to try to path-find to.
  • FunctioncomparisonCallback The callback function that will decide if each tile that is being considered for use in the path is allowed or not based on the tile map's data stored for that tile which is passed to this method as the first parameter. Must return a boolean value.
  • BooleanallowSquare Whether to allow neighboring tiles along a square axis. Defaults to true if undefined.
  • BooleanallowDiagonal Whether to allow neighboring tiles along a diagonal axis. Defaults to false if undefined.
  • BooleanallowInvalidDestination If the path finder cannot path to the destination tile, if this is true the closest path will be returned instead.
Returns Array An array of objects each containing an x, y co-ordinate that describes the path from the starting point to the end point in order.
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point