Box2D Basic

Objective

Shows how to create create a Basic Box2D / Scene2D with effects.

 

Concepts used in the code

In this example we create a World using Box2D with gravity. Then we create two Bodies, One Static, for the ground and one Dynamic for the note.

Each Body is in its own class which inherit from an Scene2d Image Actor. The actor position and angle is updated based on the Bodies position and Angle.

Code

Full Code available for download here

Continue here for creating and loading complex shapes with Box2D and LibGDX.

Advertisements