With my son egging me on, I put an effort forth tonight to finish it up enough that I can let him play it. Something about having a 5 year old cheering squad just doesn’t sound right.
So, with the collision detection done last night for the missiles, adding in the collision for the ships and asteroids was pretty easy. But then there was a decision point to be made. I had a way of detecting that ships/asteroids and missile/asteroid collided, but how to do the plumbing to do the bookkeeping that goes along with those items being involved in a collision and then removed.
To the rescue comes the C# delegates. This is an interesting construct in C#. For those not familiar with it, its kind of like an interface on a method level, in that it defines a contract for a method, rather than a class. With this, I retooled my sprite collection interface and providers to allow the delegate to be set, and then called it when an item was being removed from the given collection. This kept everything working cleanly, and the main form was the only thing that needed changing.
That being done, repurposed the FPS indicator to a scoreboard/indicator and added a status indicator on the right side of the screen. This allows communication of the current game state and all that useful information. Keeping things simple was pretty key, so I made simple transitions between the various states.
One little thing I am having problems with is that it seems like the space key (fire button) is not always being detected, in spite of me surrounding it in a locked section. Some more investigation needed there.