To create the game , i thought that i should start from developing some common usage tools.
At today , i started developing an event dispatcher with two simple functions:
- fire event
The purpose is simple: i define events with a name, and to that event i attach listeners.
When the event is fired, all listeners attached to that particular event are executed.
So an example of use could be:
and somewhere else
It’s simple ,but it works at the moment.
I’m not planning of developing an event-driven system, but if i’d need something similar, well, now i have it.