Game Design, Programming

Tower Defense, different states

Yesterday I said I was going to work on states, so that’s what I did. 😉

A State is the different states the game can be in, for example:
* StartMenuState would be the screen with New Game, High Score, Load Game, Options and Quit/Exit.
* GameState would be with the screen where the actual game is played.
* GameOverState would show when the game is over due to you losing.

I used a GameStateManager to keep track of what states there are, and which one is currently active.
Then I moved all game logic from our Engine::Run() to GameState::Run() and as far as I can tell, it works as well as it did before. No strange things that I was afraid could happen.

Tomorrow I will work on two of the other states. The “start menu”-screen and “game over”-screen. If it goes smooth and I get time for it I will try to do a ESC-menu too, otherwise that will be for another day. 

Standard

Leave a comment