This hour could have gone in 2 directions when thinking of possible things to work on. I could have worked on some more gameplay elements, such as a timer, an end state or some power-ups. Instead I chose to work on the framework of the game, for example, getting between menus and pausing the game. More behind the scene stuff.

Changing the State Machine

So, during the last hour (yesterday), I implemented a crude state machine, which could only really be in one state at a time, and when switching between states it would initialize everything in that state again from scratch. Of course, this is a bad way to do things! Mainly because of the lag that would occur when changing state on the Windows Phone 7 device, but also because of how you would have to implement pausing. It would have to be inbuilt in the GamePlay state, and if the game has more than one GamePlay state, for example, if I had multiple game modes, I would probably have to have multiple copies of the same piece of code, or create a ‘Pause’ class, which wouldn’t be as elegant a solution as this one.

Having multiple states running at the same time will require me to change my state code slightly, but not too much. I’ve added an ‘isEnabled’ bool to the base state and created each state when the game initially loads up. Each state is then Enabled and Disabled as you please.

I’ve also created a ‘PauseState’ which gets enabled and disabled at will and will display a Pause menu.

Other than that and some minor code changes, that’s all that I’ve added in this hour. It’s starting to look more like a game with a main menu and pause options now, check out my previous hour and once again, skip to around 6 mins to see the final product if you don’t want to watch me code =):


Excellent, another day, another hour. I’m still waiting for my device to come … Apparently T-Mobile are having ‘Testing Problems’ which is stopping them from distributing the handset to retailers, but I can wait since the deal I’m getting can’t be beaten!