Class PhysicsManager


  • public final class PhysicsManager
    extends java.lang.Object
    Manages the box2D world and bodies for the collision detection and physics
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.badlogic.gdx.physics.box2d.World box2DWorld  
      static boolean initialized  
    • Constructor Summary

      Constructors 
      Constructor Description
      PhysicsManager()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void cleanUp()  
      static int createBody​(com.badlogic.gdx.physics.box2d.BodyDef bDef, com.badlogic.gdx.physics.box2d.FixtureDef fDef, java.lang.Object userData)  
      static void createMapCollision​(TileMap map)
      Populates the map with box2D bodies necessary for collisions to happen.
      static com.badlogic.gdx.physics.box2d.Body getBody​(int id)  
      static void Initialize()  
      static void Initialize​(boolean drawDebug)
      Draw the box2D world with debug borders shown.
      static void update()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • initialized

        public static boolean initialized
      • box2DWorld

        public static com.badlogic.gdx.physics.box2d.World box2DWorld
    • Constructor Detail

      • PhysicsManager

        public PhysicsManager()
    • Method Detail

      • Initialize

        public static void Initialize()
      • Initialize

        public static void Initialize​(boolean drawDebug)
        Draw the box2D world with debug borders shown.
        Parameters:
        drawDebug - true to show debug borders
      • createBody

        public static int createBody​(com.badlogic.gdx.physics.box2d.BodyDef bDef,
                                     com.badlogic.gdx.physics.box2d.FixtureDef fDef,
                                     java.lang.Object userData)
      • createMapCollision

        public static void createMapCollision​(TileMap map)
        Populates the map with box2D bodies necessary for collisions to happen.
        Parameters:
        map - tilemap we are operating on
      • getBody

        public static com.badlogic.gdx.physics.box2d.Body getBody​(int id)
      • update

        public static void update()
      • cleanUp

        public static void cleanUp()