Class MapLoader
java.lang.Object
com.devcharles.piazzapanic.utility.MapLoader
Loads and owns the
TiledMap object. Creates entities from map
metadata.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Stringprivate Map<Integer,Box2dLocation> (package private) static final String(package private) static final String(package private) static final String(package private) static final Stringprivate EntityFactory(package private) static final String(package private) static final Stringcom.badlogic.gdx.maps.tiled.TiledMap(package private) static final Stringprivate int(package private) static final String(package private) static final String -
Constructor Summary
ConstructorsConstructorDescriptionMapLoader(String path, Integer ppt, EntityFactory factory) Load theTiledMapfrom a.tmxfile. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body>buildCollisions(com.badlogic.gdx.physics.box2d.World world) voidbuildFromObjects(com.badlogic.ashley.core.Engine engine, box2dLight.RayHandler rayHandler) Create lights, spawnpoints, AI paths from map metadata.voidbuildStations(com.badlogic.ashley.core.Engine engine, com.badlogic.gdx.physics.box2d.World world) Create station entities from map metadata.Get theMapof 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 theTiledMapfrom a.tmxfile.- Parameters:
path- Path to map file.ppt- Pixels per tile (default 16).factory-EntityFactoryinstance 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- AshleyEngineinstance.rayHandler-RayHandlerto add lights to.
-
getObjectives
Get theMapof 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- AshleyEngineinstance.world- The Box2D world instance to add sensor bodies to.
-