Time for action – falling bricks
With what you have learned, you can create a scene with a floor, build a wall out of brick geometries, and shoot some cannon balls at it.
- Make a copy of
Main.java
and name the classPhysicsFallingBricks.java
. Remember to also refactor the first line of themain()
method to:PhysicsFallingBricks app = new PhysicsFallingBricks();
- Make this a physical game by attaching a
BulletAppState
instance.private BulletAppState bulletAppState; @Override public void simpleInitApp() { bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); }
- Prepare some class fields for the objects in your scene. The scene uses boxes for the bricks, spheres for the cannon balls, and another box for the floor. You also prepare ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.