Class MapLoader
java.lang.Object
com.devcharles.piazzapanic.utility.MapLoader
Loads and owns the
TiledMap
object. Creates entities from map
metadata.-
Field Summary
Modifier and TypeFieldDescription(package private) static final String
private Map<Integer,
Box2dLocation> (package private) static final String
(package private) static final String
(package private) static final String
(package private) static final String
private EntityFactory
(package private) static final String
(package private) static final String
com.badlogic.gdx.maps.tiled.TiledMap
(package private) static final String
private int
(package private) static final String
(package private) static final String
-
Constructor Summary
ConstructorDescriptionMapLoader
(String path, Integer ppt, EntityFactory factory) Load theTiledMap
from a.tmx
file. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body>
buildCollisions
(com.badlogic.gdx.physics.box2d.World world) void
buildFromObjects
(com.badlogic.ashley.core.Engine engine, box2dLight.RayHandler rayHandler) Create lights, spawnpoints, AI paths from map metadata.void
buildStations
(com.badlogic.ashley.core.Engine engine, com.badlogic.gdx.physics.box2d.World world) Create station entities from map metadata.Get theMap
of objectives the AI can travel to.
-
Field Details
-
map
public com.badlogic.gdx.maps.tiled.TiledMap map -
ppt
private int ppt -
factory
-
lightIdProperty
- See Also:
-
cookSpawnPoint
- See Also:
-
aiSpawnPoint
- See Also:
-
aiObjective
- See Also:
-
objectLayer
- See Also:
-
collisionLayer
- See Also:
-
stationLayer
- See Also:
-
counterTopLayer
- See Also:
-
stationIdProperty
- See Also:
-
ingredientTypeProperty
- See Also:
-
aiObjectives
-
-
Constructor Details
-
MapLoader
Load theTiledMap
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
- AshleyEngine
instance.rayHandler
-RayHandler
to add lights to.
-
getObjectives
Get theMap
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
- AshleyEngine
instance.world
- The Box2D world instance to add sensor bodies to.
-