Using events in your game
Earlier versions of the framework used an Objective-C-inspired feature of notifications. But this particular API is already on its way to being deprecated. Instead, you should use the all-knowing Director
and its Dispatcher
(the same object we've been talking to when listening to touch events).
If you have ever worked with an MVC framework or developed a game AI system, you are probably familiar with a design pattern called the Observer Pattern. This consists of a central message dispatcher object other objects can subscribe to (observe) in order to listen to special messages, or order it to dispatch their own messages to other subscribers. In other words, it's an event model.
With Cocos2d-x, this is done very quickly and easily. Let me give you an example used in Eskimo.