Summary

We have covered much ground in this chapter. We have learned a pattern called the Observer pattern and that one class is a broadcaster and other classes called Observers can register with the broadcaster and receive updates. We used the Observer pattern to implement the first part of the user input by handling the play/pause button. We added a bit of action to the chapter when we also coded a ParticleSystem ready to use an explosion whenever the player destroys an enemy ship.

In the next chapter we will learn more useful programming patterns including one called the Entity Component pattern and another called the Factory pattern. We will use them to code and build the player ship which will be able to shoot rapid fire lasers and will be ...

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