Chapter 19: Listening with the Observer Pattern, Multitouch, and Building a Particle System
In this chapter, we will get to code and use our first design pattern. The Observer pattern is exactly what it sounds like. We will code some classes that will indeed observe another class. We will use this pattern to allow the GameEngine
class to inform other classes when they need to handle user input. This way, individual classes can handle different aspects of user input.
In addition, we will code a particle system. A particle system comprises hundreds or even thousands of graphical objects that are used to create a visual effect. Our particle system will look like an explosion.
Here is a summary of the topics that will be covered in this chapter:
- The Observer pattern
- Upgrading the player's controls to handle multitouch inputs
- Using the Observer pattern for a multitouch UI controller to listen for broadcasts from the game engine
- Implementing a particle system...