I'm making a prototype for a game. I'm working on effects at the moment, but more generally animation.
Currently, I have list where newly spawned effects are added to. Then on the update section of the game loop, I'd let each effect change their state based on time. When an effect finishes, I have it trigger an internal flag. After I update all of the effects, I check the list over again for any finished effects and remove them from the list.
It works. I figured it can be done a better way, but I'm not sure how. I mean, it runs through the list twice to update and purge finished effects. If I use an array, deletion will leave a hole there, and I'd have to track where the holes are, which seems more complicated. I figure a linked list is best? Any suggestions?