Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIPathFinder Class Reference

Inherits MOAILuaObject.

List of all members.

Function List

  findPath
  getGraph
  getPathEntry
  getPathSize
  init
  reserveTerrainWeights
  setFlags
  setGraph
  setHeuristic
  setTerrainMask
  setTerrainDeck
  setTerrainWeight
  setWeight

Function Documentation

Attempts to find an efficient path from the start node to the finish node. May be called incrementally.


function findPath ( MOAIPathFinder self [, number iterations ] )
Parameters:
self ( MOAIPathFinder )
iterations ( number ) Optional.
Returns:
more ( boolean )

Returns the attached graph (if any).


function getGraph ( MOAIPathFinder self )
Parameters:
self ( MOAIPathFinder )
Returns:
graph ( MOAIPathGraph )

Returns a path entry. This is a node ID that may be passed back to the graph to get a location.


function getPathEntry ( MOAIPathFinder self, number index )
Parameters:
self ( MOAIPathFinder )
index ( number )
Returns:
entry ( number )

Returns the size of the path (in nodes).


function getPathSize ( MOAIPathFinder self )
Parameters:
self ( MOAIPathFinder )
Returns:
size ( number )

Specify the ID of the start and target node.


function init ( MOAIPathFinder self, number startNodeID, number targetNodeID )
Parameters:
self ( MOAIPathFinder )
startNodeID ( number )
targetNodeID ( number )
Returns:
nil

Specify the size of the terrain weight vector.


function reserveTerrainWeights ( MOAIPathFinder self [, number size ] )
Parameters:
self ( MOAIPathFinder )
size ( number ) Optional. Default value is 0.
Returns:
nil

Set flags to use for pathfinding. These are graph specific flags provided by the graph implementation.


function setFlags ( MOAIPathFinder self [, number heuristic ] )
Parameters:
self ( MOAIPathFinder )
heuristic ( number ) Optional.
Returns:
nil

Set graph data to use for pathfinding.


function setGraph ( MOAIPathFinder self [, MOAIGrid grid ] )
Parameters:
self ( MOAIPathFinder )
grid ( MOAIGrid ) Optional. Default value is nil.
Returns:
nil
Note:

function setGraph ( MOAIPathFinder self [, MOAIGridPathGraph gridPathGraph ] )
Parameters:
self ( MOAIPathFinder )
gridPathGraph ( MOAIGridPathGraph ) Optional. Default value is nil.
Returns:
nil
Note:

Set heuristic to use for pathfinding. This is a const provided by the graph implementation being used.


function setHeuristic ( MOAIPathFinder self [, number heuristic ] )
Parameters:
self ( MOAIPathFinder )
heuristic ( number ) Optional.
Returns:
nil

Set terrain deck to use with graph.


function setTerrainDeck ( MOAIPathFinder self [, MOAIPathTerrainDeck terrainDeck ] )
Parameters:
self ( MOAIPathFinder )
terrainDeck ( MOAIPathTerrainDeck ) Optional. Default value is nil.
Returns:
nil

Set 32-bit mask to apply to terrain samples.


function setTerrainMask ( MOAIPathFinder self [, number mask ] )
Parameters:
self ( MOAIPathFinder )
mask ( number ) Optional. Default value is 0xffffffff.
Returns:
nil

Set a component of the terrain weight vector.


function setTerrainWeight ( MOAIPathFinder self, number index [, number deltaScale, number penaltyScale ] )
Parameters:
self ( MOAIPathFinder )
index ( number )
deltaScale ( number ) Optional. Default value is 0.
penaltyScale ( number ) Optional. Default value is 0.
Returns:
nil

Sets weights to be applied to G and H.


function setWeight ( MOAIPathFinder self [, number gWeight, number hWeight ] )
Parameters:
self ( MOAIPathFinder )
gWeight ( number ) Optional. Default value is 1.0.
hWeight ( number ) Optional. Default value is 1.0.
Returns:
nil