Thursday, September 20, 2012

Day 20 - Game State Management

Game State Management is perhaps the most fundamental thing about game programming. I've been avoiding it until now, but I need to start implementing lives and new levels soon. To do this the game needs to transition between different "states". For example, one state would be a title screen, one state would be the actual gameplay, and finally a game over state. To make all this happen, all the logic needs to reside on screens. When one screen exits, it will destroy all the images and things it was using before the next screen is loaded.

There is a great example about GSM in the XNA tutorials. It contains a bare-bones screen manager with a bunch of example screens. In about an hour I merged this code with my game and got it working. Now there is a menu screen which transitions to the first level when the user hits enter on their keyboard! Whooooo!

Things to do from here:

  1. Spruce up the title screen
  2. Add a level transition screen which shows the level number and number of lives left
    1. When the level starts or Mario dies the level transition screen should be shown and the level should be restarted
  3. Add a transition to the next level
  4. Add a Game Over screen which routes back to the menu screen
I've been super busy this week (getting home around 7pm everyday!) so I haven't had much time to work on this. I'm gone for the weekend but have nothing to do Monday and Tuesday so hopefully I'll get a lot done then!

No video for today...

No comments:

Post a Comment