Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Event System

Sign in to follow this  


So, I had previously worked on my event system, and I had tested it, but I ended up putting it in the back burner because I needed to do some graphics work. But, as I do more and more work, the need for an event system is becoming more urgent, or at least more desirable.

I'm not entirely happy with my current implementation because it uses templates, and templates have a way of becoming hard to manage the more you work with them. Another problem I have with them using templates is that it became a bit troublesome when I decided to work on the event manager class (aka, the event scheduler).

But, this is what it looks like right now:

All the main application is doing is randomly issuing "Fire" event on the good or evil ships, when the good ship fires, the evil ship listens for that event and determines that it has been hit. If a ship's health reaches 0, it executes the "Destroyed" event. What I didnt do, but would be trivial is to make the other ship listen for the "Destroyed" event and display a message, such as "I win. bitch", but it wasn't necessary because I had already proved that all listeners listen for the event and react appropiately to it.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!