Class MapLoader

java.lang.Object
com.devcharles.piazzapanic.utility.MapLoader

public class MapLoader extends Object
Loads and owns the TiledMap object. Creates entities from map metadata.
  • Field Details

  • Constructor Details

    • MapLoader

      public MapLoader(String path, Integer ppt, EntityFactory factory)
      Load the TiledMap from a .tmx file.
      Parameters:
      path - Path to map file.
      ppt - Pixels per tile (default 16).
      factory - EntityFactory instance to create entities based on the map metadata.
  • Method Details

    • buildCollisions

      public com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body> buildCollisions(com.badlogic.gdx.physics.box2d.World world)
      Parameters:
      world - The Box2D world instance to add bodies to.
      Returns:
      The bodies created from the map.
    • buildFromObjects

      public void buildFromObjects(com.badlogic.ashley.core.Engine engine, box2dLight.RayHandler rayHandler)
      Create lights, spawnpoints, AI paths from map metadata.
      Parameters:
      engine - Ashley Engine instance.
      rayHandler - RayHandler to add lights to.
    • getObjectives

      public Map<Integer,Box2dLocation> getObjectives()
      Get the Map of objectives the AI can travel to. See the map file in the Tiled editor to preview ai objectives.
      Returns:
    • buildStations

      public void buildStations(com.badlogic.ashley.core.Engine engine, com.badlogic.gdx.physics.box2d.World world)
      Create station entities from map metadata. Metadata is given to the tile in Edit Tileset -> Tile Properties.
      Parameters:
      engine - Ashley Engine instance.
      world - The Box2D world instance to add sensor bodies to.