Packagebe.dauntless.astar.core
Classpublic class Astar
InheritanceAstar Inheritance flash.events.EventDispatcher

The main search algorithm and core class of this Astar library.



Public Properties
 PropertyDefined By
  intervalTime : Number
[write-only] Sets the time between two consecutive iteration series.
Astar
  iterations : Number
[write-only] Sets the number of iterations done within 1 timespan.
Astar
  safety : String
Returns the current safety level.
Astar
Public Methods
 MethodDefined By
  
Astar(cache:Boolean = false)
Creates a new Astar instance
Astar
  
addAnalyzer(analyzer:Analyzer):void
Add an analyzer to the analyzer chain.
Astar
  
clearCache():void
Clears the cached paths
Astar
  
getPath(item:PathRequest):void
Enqueues the given PathRequest or executes the request if the queue is empty.
Astar
Public Constants
 ConstantDefined By
  NO_CHECK : String = noCheck
[static] If Astar.safeMode is set to NO_CHECK, nothing will be checked for at the start of a new search
Astar
  NORMAL_CHECK : String = normalCheck
[static] If Astar.safeMode is set to NORMAL_CHECK (default), the following will be tested: - The end tile has to be a valid tile according to the analyzers (Analyzer.analyzeTile) Note that only the end tile is checked.
Astar
Property Detail
intervalTimeproperty
intervalTime:Number  [write-only]

Sets the time between two consecutive iteration series.


Implementation
    public function set intervalTime(value:Number):void
iterationsproperty 
iterations:Number  [write-only]

Sets the number of iterations done within 1 timespan.


Implementation
    public function set iterations(value:Number):void
safetyproperty 
safety:String

Returns the current safety level.


Implementation
    public function get safety():String
    public function set safety(value:String):void
Constructor Detail
Astar()Constructor
public function Astar(cache:Boolean = false)

Creates a new Astar instance

Parameters
cache:Boolean (default = false) — If set to true, Astar will remember paths that have been found and it will returned cached paths in stead of searching for the path again. Set to true if your map always stays the same and all your PathRequests will have the same conditions. (Default = false)
Method Detail
addAnalyzer()method
public function addAnalyzer(analyzer:Analyzer):void

Add an analyzer to the analyzer chain. Analyzers added to the Astar instance will be checked before analyzers added to the PathRequest

Parameters

analyzer:Analyzer — The analyzer to add to the analyzer chain

clearCache()method 
public function clearCache():void

Clears the cached paths

getPath()method 
public function getPath(item:PathRequest):void

Enqueues the given PathRequest or executes the request if the queue is empty. When a path is found, an AstarEvent.PATH_FOUND event is dispatched. If caching is set to true and a cached path is found, the PathRequest will not be added to the queue and the cached path will be dispatched immediately.

Parameters

item:PathRequest — The PathRequest containing the search info

Constant Detail
NO_CHECKConstant
public static const NO_CHECK:String = noCheck

If Astar.safeMode is set to NO_CHECK, nothing will be checked for at the start of a new search

NORMAL_CHECKConstant 
public static const NORMAL_CHECK:String = normalCheck

If Astar.safeMode is set to NORMAL_CHECK (default), the following will be tested: - The end tile has to be a valid tile according to the analyzers (Analyzer.analyzeTile) Note that only the end tile is checked. It is assumed that you start from a valid position.