On this page, you can download sample Java/Android game projects for further study. This page will be updated frequently. To request a certain project, please contact us. If you are looking for source code that accompanies the book, please click here.

Android Technical Samples

1. Handling various screen resolutions (Coming soon)

The examples shown in the book use a fixed game resolution of (800 x 450). The main problem with this approach was that devices with screens larger than 800 x 450 suffered graphically due to the upscaling of the images. On the other hand, devices with screens smaller than 800 x 450 wasted memory on loading images larger than the device’s screen resolution.

This sample project demonstrates an alternative approach, which uses a dynamic game resolution that matches the device’s screen resolution. It also shows how the Options.inSampleSize may be used to smartly load an image at a size that is appropriate for the device.

2. Multiple loading screens (Click here to download)

As you build bigger games, you will no doubt find yourself running out of memory. This example demonstrates how to load and unload a set of Assets as they become needed and unneeded.

3. Displaying text without allocating String objects (Coming soon)

Android Game Samples

(Coming soon)

Java Game Samples

1. Flappy Bird Clone (Click here to download)

 

zombie

This sample is an example of a Flappy Bird clone, demonstrating how to rotate images, subsample images from a larger one (split a texture atlas into many smaller images), and scale a game image to fit a variable window size. It also demonstrates how to maintain various modes in a single state (see GameState class). It also emphasizes delegation via the relationship demonstrated between GameState, GameWorld, and GameRenderer.

Note: Score and high score systems are not implemented in this example.