Class MapBodyBuilder
java.lang.Object
com.devcharles.piazzapanic.utility.box2d.MapBodyBuilder
Populates the world with bodies created from the obstacle layer. Used for
creating collisions.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body>
buildShapes
(com.badlogic.gdx.maps.Map map, float pixels, com.badlogic.gdx.physics.box2d.World world) Create collision boxes from the MapObjects on the Obstacle object layer.private static com.badlogic.gdx.physics.box2d.Shape
decideShape
(com.badlogic.gdx.maps.MapObject object) private static com.badlogic.gdx.physics.box2d.CircleShape
getCircle
(com.badlogic.gdx.maps.objects.CircleMapObject circleObject) private static com.badlogic.gdx.physics.box2d.PolygonShape
getPolygon
(com.badlogic.gdx.maps.objects.PolygonMapObject polygonObject) private static com.badlogic.gdx.physics.box2d.ChainShape
getPolyline
(com.badlogic.gdx.maps.objects.PolylineMapObject polylineObject) private static com.badlogic.gdx.physics.box2d.PolygonShape
getRectangle
(com.badlogic.gdx.maps.objects.RectangleMapObject rectangleObject)
-
Field Details
-
ppt
private static float ppt
-
-
Constructor Details
-
MapBodyBuilder
public MapBodyBuilder()
-
-
Method Details
-
buildShapes
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.physics.box2d.Body> buildShapes(com.badlogic.gdx.maps.Map map, float pixels, com.badlogic.gdx.physics.box2d.World world) Create collision boxes from the MapObjects on the Obstacle object layer.- Parameters:
map
-TiledMap
to create bodies from.pixels
- Pixels per tile (default 16).world
- Box2DWorld
to create objects in.- Returns:
-
decideShape
private static com.badlogic.gdx.physics.box2d.Shape decideShape(com.badlogic.gdx.maps.MapObject object) -
getRectangle
private static com.badlogic.gdx.physics.box2d.PolygonShape getRectangle(com.badlogic.gdx.maps.objects.RectangleMapObject rectangleObject) -
getCircle
private static com.badlogic.gdx.physics.box2d.CircleShape getCircle(com.badlogic.gdx.maps.objects.CircleMapObject circleObject) -
getPolygon
private static com.badlogic.gdx.physics.box2d.PolygonShape getPolygon(com.badlogic.gdx.maps.objects.PolygonMapObject polygonObject) -
getPolyline
private static com.badlogic.gdx.physics.box2d.ChainShape getPolyline(com.badlogic.gdx.maps.objects.PolylineMapObject polylineObject)
-