Saturday, February 18, 2012

updates event handler edition

Do gibs even belong in this game?
Alright more progress. I had events working before, and have had enemy entities moving around and such. But finally got in "attack" code right now. It happens when an entity moves onto another entity and right now only the player entity has it. Automaticaly sets the others HP to -9999 and their color to red, after that I had to get on_death functions working to properly drop gibs (and later real items), remove itself from the room, and add a death message to the event handler. Right now the event handler is really just a glorified list that keeps 5 lines of text in check, but it's effect is much more so I'll take a moment to talk about it.

The philosophy behind the event handler is that it gets passed to every instance that uses it so that they can take care of themselves. So you get hit and the character object that defines you does calculations, sees that it has an event handler and uses the event handlers add function to put another line on there. This is also used for the doors, the item pick ups, everything. It keeps the main loop from having to know what every single entity does under the hood to properly display the text which I find to be quite useful.

Now I'm not sure wha tthe next step shoudl be. I may play with giving the enemy mobs some attack code and properly patching them up so they don't "eat" each other by destroying their fellow moblin/goblin/mogoblin id at locations or walk through "doors" and cause all sorts of trouble.

4 comments:

  1. such a lazy b*tard I am, I forget to install this all the time. I don't use the computer very often on the weekend.

    ReplyDelete
  2. just be lazy and say the mogoblins eating each other is a feature

    ReplyDelete