Tuesday, January 12, 2010

Daily Developer: Day 11

I picked up where I left off yesterday: trying to figure out how to detect if the shooter was moving off the edge of the window. After struggling with this for a little bit, and realizing that it shouldn't be this complicated, I decided that it was now a good time to start refactoring.

I have been keeping track of almost everything in the main game object. I do have a target object that I had created early on, but had been keeping track of a number of shooter properties separately. So, I created a Shooter class and moved over all the code pertaining to it from the game class.

It also occurred to me that there were a number of elements that were going to be shared between the shooter and the targets, like Position, for instance. I created a base class, as well as an interface, and started moving shared elements into the new structures.

I will continue with my refactoring tomorrow, and maybe I will eventually get back to calculating the boundary, now that it should be easier. I am also thinking about creating the "ammo" object for the actual shooting part of the game.

Was on a roll today and had to pull myself away as I started to exceed an hour. I don't want to burn myself out, and a good motivator is to stop when you already know what is coming next.

Duration: 01:03:30

No comments:

Post a Comment