O'Reilly logo

jMonkeyEngine 3.0 Beginner's Guide by Ruth Kusterer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

  1. Make a copy of Main.java and name the class PhysicsFallingBricks.java. Remember to also refactor the first line of the main() method to:
    PhysicsFallingBricks app = new PhysicsFallingBricks();
  2. Make this a physical game by attaching a BulletAppState instance.
    private BulletAppState bulletAppState;
    @Override
    public void simpleInitApp() {
      bulletAppState = new BulletAppState();
      stateManager.attach(bulletAppState);
    }
  3. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required