Package com.mygdx.game.Managers
Class PhysicsManager
java.lang.Object
com.mygdx.game.Managers.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.Worldbox2DWorldstatic booleaninitialized -
Constructor Summary
Constructors Constructor Description PhysicsManager() -
Method Summary
Modifier and Type Method Description static voidcleanUp()static intcreateBody(com.badlogic.gdx.physics.box2d.BodyDef bDef, com.badlogic.gdx.physics.box2d.FixtureDef fDef, java.lang.Object userData)static voidcreateMapCollision(TileMap map)Populates the map with box2D bodies necessary for collisions to happen.static com.badlogic.gdx.physics.box2d.BodygetBody(int id)static voidInitialize()static voidInitialize(boolean drawDebug)Draw the box2D world with debug borders shown.static voidupdate()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
initialized
public static boolean initialized -
box2DWorld
public static com.badlogic.gdx.physics.box2d.World box2DWorld
-
-
Constructor Details
-
PhysicsManager
public PhysicsManager()
-
-
Method Details
-
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
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()
-