Chapter 3. Interacting with the User

The main loop is your game's Dungeon Master, referee, and director: it listens for user input, updates the game state, and renders the output. In a game of Blockout, the loop drops blocks and clears finished layers. In a car racer, the loop calculates friction and acceleration. In a first-person shooter, the loop respawns enemies. The loop is where you make sure everyone sticks to the rules, and where you determine whether the player has won or lost.

In the previous chapter, we learnt how to initialize a 3D scene using the simpleInitApp() method from the SimpleApplication class. You can translate, scale, and rotate objects into their start positions, and navigate the scene using the mouse and W, A, S, and ...

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.