Coordinating global game mechanics

Now you know three modular ways of running code as part of the main update loop: you can implement the simpleUpdate() method in the main class, you can add controls to spatials, and you can attach AppState objects.

Coordinating global game mechanics

You can activate or deactivate an individual chunk of behavior by adding or removing a control, or by attaching and detaching an AppState object. You can move whole chunks of the scene graph out of the main simpleInitApp() method, and make them part of an AppState object. For example, a hypothetical OutdoorsAppState object's initialize() method attaches bright lights and a forest sound loop; its cleanup() ...

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.