Coding Dynamic Events?

Posted by Joey Green on Game Development See other posts from Game Development or by Joey Green
Published on 2012-10-17T13:36:24Z Indexed on 2012/10/17 17:22 UTC
Read the original article Hit count: 378

Filed under:

I have no idea what the title of this question should be so bare with me.

My game has turns. On a turn a player does something and this can result in a random number of explosions that occur at different times. I know when the explosions are done. I need to know when ALL are done and then do some other action. Also, each explosion is the same amount of time, say 3 seconds..

Right now I'm thinking of using a counter to hold how many explosions are happening. Then once the explosion is finished decrement this counter. Once the counter is zero, do my action. This idea is inspired by objective-c memory management btw. Anyways, does this sound like a good approach or would there be another way.

An alternative might be to figure out the explosion who happened last and let it be responsible for calling this subsequent action.

I'm asking mostly, because I haven't done this before and am trying to figure out if there are bugs that may occur that I'm not foreseeing.

© Game Development or respective owner

Related posts about events