Class 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TileMapGraph

        public TileMapGraph​(com.badlogic.gdx.maps.tiled.TiledMap map)
        Creates a Graph from the given tilemap
        Parameters:
        map - the source tilemap
    • Method Detail

      • getNode

        public Node getNode​(float x,
                            float y)
        Node a position (x, y)
        Parameters:
        x - co-ord
        y - co-ord
        Returns:
        Node at (x, y) or null
      • getIndex

        public int getIndex​(Node node)
        Specified by:
        getIndex in interface com.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 interface com.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 interface com.badlogic.gdx.ai.pfa.Graph<Node>
        Parameters:
        fromNode - the node being queried
        Returns:
        the list of connections present starting from the parsed node