The Next Level

Building on the topics covered in Chapter 5, this chapter shows you how to build your own infinite-runner with framerate independent movement, animation states and scrolling obstacles. The chapter also begins a discussion on game optimization techniques and discusses how to minimize garbage collection.

Source Code

The following .zip download contains the full source code for each programming example provided in this chapter.

Download the Source Code (Chapter 6)


1. SimpleJavaGDF2 – Checkpoint 1: Update game loop timing mechanism. Add frame to frame delta calculation.

2. SimpleJavaGDF2 – Checkpoint 2: Adds animation classes.

3. SimpleJavaGDF2 – Checkpoint 3: Begins adding game-specific model classes for Ellio.

4. SimpleJavaGDF2 – Complete: Full source code for Ellio. All the game state classes implemented.

Importing Instructions:

Click Here to see how to import the above projects into your workspace.


The following .zip download contains all assets used in this chapter.

Download the Assets (Chapter 6)


iconimage.png, welcome.png, selector.png, cloud1.png, cloud2.png, runanim1.png, runanim2.png, runanim3.png, runanim4.png, runanim5.png, duck.png, jump.png, grass.png, block.png, onjump.wav, hit.wav

Additional Information

1. For a list of all known in-text errors, please see the Errata.

This section will be updated as needed. Please post on our forums if you need assistance or explanation on topics covered in this chapter.