Class ftAStar |
Description: | The class ftAStar provides A-Star pathfinding functionality for fantomEngine. The calculated paths can be used to set up waypoints for the ftWaypoint class. |
Table of contents: | Methods:
- AddNode ( Method AddNode:ftGridNode(ID:Int, xpos:Float, ypos:Float, relative:Bool = False) ) Changed in v1.55
- Connect ( Method Connect:Void(parentIndex:Int, childIndex:Int, bothSides:Bool = False) )
- ConnectByID ( Method ConnectByID:Void(parentID:Int, childID:Int, bothSides:Bool = False) )
- FindClosestNode ( Method FindClosestNode:ftGridNode(xpos:Float, ypos:Float) )
- FindPath ( Method FindPath:Float(startIndex:Int, endIndex:Int) )
- GetAngle ( Method GetAngle:Float() ) New in v.155
- GetBlock ( Method GetBlock:bool(index:Int) )
- GetChild ( Method GetChild:ftGridNode(parentIndex:Int, childIndex:Int) )
- GetChildCount ( Method GetChildCount:Int(index:Int) )
- GetNode ( Method GetNode:ftGridNode(index:Int) )
- GetNodeByID ( Method GetNodeByID:ftGridNode(id:Int) )
- GetNodeCount ( Method GetNodeCount:Int() )
- GetNodeID ( Method GetNodeID:Int(index:Int) )
- GetNodeIndex ( Method GetNodeIndex:Int(id:Int) )
- GetPathNode ( Method GetPathNode:ftGridNode(index:Int) )
- GetPathNodeCount ( Method GetPathNodeCount:Int() )
- GetPos ( Method GetPos:Float[](index:Int) )
- GetPosX ( Method GetPosX:Float(index:Int) )
- GetPosY ( Method GetPosY:Float(index:Int) )
- GetScaleX ( Method GetScaleX:Float() ) New in v.155
- GetScaleY ( Method GetScaleY:Float() ) New in v.155
- LoadFromString ( Method LoadFromString:Void(ps:String) )
- Remove ( Method Remove:Void() )
- RemoveAllNodes ( Method RemoveAllNodes:Void() )
- Render ( Method Render:Void(size:Int=20) )
- SaveToString ( Method SaveToString:String() )
- SetAngle ( Method SetAngle:Void(a:Float, relative:Bool = False) )
- SetBlock ( Method SetBlock:Void(index:Int, blockFlag:Bool) )
- SetPos ( Method SetPos:Void(x:Float, y:Float, relative:Bool = False) ) Changed in v1.55
- SetPos ( Method SetPos:Void(y:Float, relative:Bool = False) ) Changed in v1.55
- SetPosX ( Method SetPosX:Void(x:Float, relative:Bool = False) ) Changed in v1.55
- SetScale ( Method SetScale:Void(x:Float, y:Float, relative:Bool = False) ) Changed in v1.55.
|
Method AddNode:ftGridNode(ID:Int, xpos:Float, ypos:Float, relative:Bool = False) | Syntax:
| ftGridNode = ftAStar.AddNode (ID:Int, xpos:Float, ypos:Float, relative:Bool = False) | Changes: | Changed in v1.55
| Description: | Add a node to a grid. | Return type: | ftGridNode | Parameters: | Name | Type | Value |
---|
ID | Int | | xpos | Float | | ypos | Float | | relative | Bool | False |
|
|
Method Connect:Void(parentIndex:Int, childIndex:Int, bothSides:Bool = False) | Syntax:
| ftAStar.Connect (parentIndex:Int, childIndex:Int, bothSides:Bool = False) | Description: | Connect a child node to its parent node by their node index. | Parameters: | Name | Type | Value |
---|
parentIndex | Int | | childIndex | Int | | bothSides | Bool | False |
|
|
Method ConnectByID:Void(parentID:Int, childID:Int, bothSides:Bool = False) | Syntax:
| ftAStar.ConnectByID (parentID:Int, childID:Int, bothSides:Bool = False) | Description: | Connect a child node to its parent node by their ID values. | Parameters: | Name | Type | Value |
---|
parentID | Int | | childID | Int | | bothSides | Bool | False |
|
|
Method FindClosestNode:ftGridNode(xpos:Float, ypos:Float) | Syntax:
| ftGridNode = ftAStar.FindClosestNode (xpos:Float, ypos:Float) | Description: | To find the closest node of a grid to a given position, use this method. | Return type: | ftGridNode | Parameters: | Name | Type | Value |
---|
xpos | Float | | ypos | Float | |
|
|
Method FindPath:Float(startIndex:Int, endIndex:Int) | Syntax:
| Float = ftAStar.FindPath (startIndex:Int, endIndex:Int) | Description: | Calculates a path between two grid nodes and return the length of the path in pixel. | Return type: | Float | Parameters: | Name | Type | Value |
---|
startIndex | Int | | endIndex | Int | |
|
|
Method GetAngle:Float() | Syntax:
| Float = ftAStar.GetAngle () | Changes: | New in v.155
| Description: | Returns the angle of the grid. | Return type: | Float |
|
Method GetBlock:bool(index:Int) | Syntax:
| bool = ftAStar.GetBlock (index:Int) | Description: | Returns the block flag of a grid node. | Return type: | bool | Parameters: | |
|
Method GetChild:ftGridNode(parentIndex:Int, childIndex:Int) | Syntax:
| ftGridNode = ftAStar.GetChild (parentIndex:Int, childIndex:Int) | Description: | Returns the the child grid node of a parent grid node specified both by index. Index start at 1. | Return type: | ftGridNode | Parameters: | Name | Type | Value |
---|
parentIndex | Int | | childIndex | Int | |
|
|
Method GetChildCount:Int(index:Int) | Syntax:
| Int = ftAStar.GetChildCount (index:Int) | Description: | Returns the number of child nodes of a child node. | Return type: | Int | Parameters: | |
|
Method GetNode:ftGridNode(index:Int) | Syntax:
| ftGridNode = ftAStar.GetNode (index:Int) | Description: | Get the node with the given index. Index starts with 1. | Return type: | ftGridNode | Parameters: | |
|
Method GetNodeByID:ftGridNode(id:Int) | Syntax:
| ftGridNode = ftAStar.GetNodeByID (id:Int) | Description: | Get the node with the given ID. | Return type: | ftGridNode | Parameters: | |
|
Method GetNodeCount:Int() | Syntax:
| Int = ftAStar.GetNodeCount () | Description: | Returns the grid node count. | Return type: | Int |
|
Method GetNodeID:Int(index:Int) | Syntax:
| Int = ftAStar.GetNodeID (index:Int) | Description: | Get the node ID with the given index. Index starts with 1. | Return type: | Int | Parameters: | |
|
Method GetNodeIndex:Int(id:Int) | Syntax:
| Int = ftAStar.GetNodeIndex (id:Int) | Description: | Get the node index with the given ID. Index starts with 1. | Return type: | Int | Parameters: | |
|
Method GetPathNode:ftGridNode(index:Int) | Syntax:
| ftGridNode = ftAStar.GetPathNode (index:Int) | Description: | Get the grid node with the given index. Index starts with 1. | Return type: | ftGridNode | Parameters: | |
|
Method GetPathNodeCount:Int() | Syntax:
| Int = ftAStar.GetPathNodeCount () | Description: | Returns the path node count of the last calculated path. | Return type: | Int |
|
Method GetPos:Float[](index:Int) | Syntax:
| Float[] = ftAStar.GetPos (index:Int) | Description: | Returns the X and Y position of a grid node. | Return type: | Float[] | Parameters: | |
|
Method GetPosX:Float(index:Int) | Syntax:
| Float = ftAStar.GetPosX (index:Int) | Description: | Returns the X position of a grid node. | Return type: | Float | Parameters: | |
|
Method GetPosY:Float(index:Int) | Syntax:
| Float = ftAStar.GetPosY (index:Int) | Description: | Returns the Y position of a grid node. | Return type: | Float | Parameters: | |
|
Method GetScaleX:Float() | Syntax:
| Float = ftAStar.GetScaleX () | Changes: | New in v.155
| Description: | Returns the X scale factor of the grid. | Return type: | Float |
|
Method GetScaleY:Float() | Syntax:
| Float = ftAStar.GetScaleY () | Changes: | New in v.155
| Description: | Returns the Y scale factor of the grid. | Return type: | Float |
|
Method LoadFromString:Void(ps:String) | Syntax:
| ftAStar.LoadFromString (ps:String) | Description: | Load a grid from a string. | Parameters: | |
|
Method Remove:Void() | Syntax:
| ftAStar.Remove () | Description: | Removes the complete grid. |
|
Method RemoveAllNodes:Void() | Syntax:
| ftAStar.RemoveAllNodes () | Description: | Removes all grid nodes. |
|
Method Render:Void(size:Int=20) | Syntax:
| ftAStar.Render (size:Int=20) | Description: | Render the grid. | Parameters: | |
|
Method SaveToString:String() | Syntax:
| String = ftAStar.SaveToString () | Description: | Save a path to a string. | Return type: | String |
|
Method SetAngle:Void(a:Float, relative:Bool = False) | Syntax:
| ftAStar.SetAngle (a:Float, relative:Bool = False) | Description: | Sets the angle of a grid and position its nodes regarding the angle. | Parameters: | Name | Type | Value |
---|
a | Float | | relative | Bool | False |
|
|
Method SetBlock:Void(index:Int, blockFlag:Bool) | Syntax:
| ftAStar.SetBlock (index:Int, blockFlag:Bool) | Description: | Set the block flag of a grid node. | Parameters: | Name | Type | Value |
---|
index | Int | | blockFlag | Bool | |
| Details: | A blocked grid node won't be visited during the path finding
|
|
Method SetPos:Void(x:Float, y:Float, relative:Bool = False) | Syntax:
| ftAStar.SetPos (x:Float, y:Float, relative:Bool = False) | Changes: | Changed in v1.55
| Description: | Sets the position of a grid and its nodes. | Parameters: | Name | Type | Value |
---|
x | Float | | y | Float | | relative | Bool | False |
|
|
Method SetPos:Void(y:Float, relative:Bool = False) | Syntax:
| ftAStar.SetPos (y:Float, relative:Bool = False) | Changes: | Changed in v1.55
| Description: | Sets the Y position of a grid and its nodes. | Parameters: | Name | Type | Value |
---|
y | Float | | relative | Bool | False |
|
|
Method SetPosX:Void(x:Float, relative:Bool = False) | Syntax:
| ftAStar.SetPosX (x:Float, relative:Bool = False) | Changes: | Changed in v1.55
| Description: | Sets the X position of a grid and its nodes. | Parameters: | Name | Type | Value |
---|
x | Float | | relative | Bool | False |
|
|
Method SetScale:Void(x:Float, y:Float, relative:Bool = False) | Syntax:
| ftAStar.SetScale (x:Float, y:Float, relative:Bool = False) | Changes: | Changed in v1.55.
| Description: | Sets the scale of a grid and position its nodes regarding the angle. | Parameters: | Name | Type | Value |
---|
x | Float | | y | Float | | relative | Bool | False |
|
|