O'Reilly logo

jMonkeyEngine 3.0 Cookbook by Rickard Edén

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

The principles of a bridge-building game

Variants of bridge-building games have been around for a long time. The classical Bridge Builder is a 2D physics game where the player is required connect beams to create a bridge strong enough for a train (or some other moving object) to pass.

This recipe will describe most of the core functionalities needed to create such a game, including making the objects stay 2D and not wander off on the z axis.

We'll have some basic controls for the game:

  • Left-click will select a previously built node in the bridge
  • Right-click will add a new node or connect two previously built ones
  • The Space bar will turn on the physics

The following figure shows a bridge:

Getting ready

Before we begin with more physics-related functions, ...

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