Chapter 9: The Game Engine, Threads, and the Game Loop

In this chapter, we will see the game engine come together. By the end of the chapter, we will have an exciting blank screen that draws debugging text at 60 frames per second on a real device, although probably less on an emulator. While doing so, we will learn about programming threads, try-catch blocks, the Runnable interface, the Android activity lifecycle, and the concept of a game loop.

My expression of excitement for a blank screen might seem sarcastic but once this chapter is done, we will be able to code and add game objects, almost at will. We will see how much we have achieved in this chapter when we add the moving ball and controllable bat in the next one. Furthermore, this game ...

Get Learning Java by Building Android Games - Third Edition 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.