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)intgetIndex(Node node)NodegetNode(float x, float y)Node a position (x, y)intgetNodeCount()
-
-
-
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:
getIndexin 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:
getNodeCountin 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:
getConnectionsin interfacecom.badlogic.gdx.ai.pfa.Graph<Node>- Parameters:
fromNode- the node being queried- Returns:
- the list of connections present starting from the parsed node
-
-