Class MapBodyBuilder

java.lang.Object
com.devcharles.piazzapanic.utility.box2d.MapBodyBuilder

public class MapBodyBuilder extends Object
Populates the world with bodies created from the obstacle layer. Used for creating collisions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - Box2D World 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)