Package com.mygdx.game.AI
Class TileMapGraph
- java.lang.Object
-
- com.mygdx.game.AI.TileMapGraph
-
- All Implemented Interfaces:
com.badlogic.gdx.ai.pfa.Graph<Node>
,com.badlogic.gdx.ai.pfa.indexed.IndexedGraph<Node>
public class TileMapGraph extends java.lang.Object implements com.badlogic.gdx.ai.pfa.indexed.IndexedGraph<Node>
The Graphical representation of the tilemap with each cell being bidirectionally to the adjacent nodes.
-
-
Constructor Summary
Constructors Constructor Description TileMapGraph(com.badlogic.gdx.maps.tiled.TiledMap map)
Creates a Graph from the given tilemap
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.badlogic.gdx.utils.Array<com.badlogic.gdx.ai.pfa.Connection<Node>>
getConnections(Node fromNode)
int
getIndex(Node node)
Node
getNode(float x, float y)
Node a position (x, y)int
getNodeCount()
-
-
-
Method Detail
-
getNode
public Node getNode(float x, float y)
Node a position (x, y)- Parameters:
x
- co-ordy
- co-ord- Returns:
- Node at (x, y) or null
-
getIndex
public int getIndex(Node node)
- Specified by:
getIndex
in interfacecom.badlogic.gdx.ai.pfa.indexed.IndexedGraph<Node>
- Parameters:
node
- the node being queried- Returns:
- the index of the parsed node
-
getNodeCount
public int getNodeCount()
- Specified by:
getNodeCount
in interfacecom.badlogic.gdx.ai.pfa.indexed.IndexedGraph<Node>
- Returns:
- the amount of nodes present in the map
-
getConnections
public com.badlogic.gdx.utils.Array<com.badlogic.gdx.ai.pfa.Connection<Node>> getConnections(Node fromNode)
- Specified by:
getConnections
in interfacecom.badlogic.gdx.ai.pfa.Graph<Node>
- Parameters:
fromNode
- the node being queried- Returns:
- the list of connections present starting from the parsed node
-
-