Game Development Reference
In-Depth Information
Chapter 3
Explore the Game Application
Life Cycle
There is more to a game than just the fun parts. Almost all of the games on the market, and definitely
the big titles, involve multiple views and a reasonably complex life cycle. This chapter explores how
to turn a simple game into a complete application. We will look at how a typical game organizes the
different views that constitute it, including a Loading view, a Welcome view, a High Score view, and
of course the game itself.
Beyond user navigation, an application also has a life cycle. On iOS, that life cycle includes
responding to the application being terminated, recovering from being in the background, or starting
up for the first time. When an application moves through its life cycle, it will want to preserve
elements of the user data, like high scores and the state of the game. Paying attention to these little
details will make your game look polished instead of amateurish and annoying.
While the game presented here is not very exciting, and the art is admittedly amateurish, you will be
able to take the basic outline presented here and drop your own game into it. You should update
your art, though!
Understanding the Views in a Game
The game presented in this chapter is called Coin Sorter. It is a simple puzzle game in which the
player sorts coins into rows and columns. The player has ten turns to make as many matching rows
or columns as possible. The fun part of this game is just about as simple as an iOS game can get.
The playable part of this game consists of just two classes, CoinsController and CoinsGame . As the
names of these two classes suggest, CoinsController is responsible for rendering the game to the
screen and interpreting player actions. CoinsGame is responsible for storing the state of the game
and providing a few utility methods for manipulating that state. The details of how these two classes
work is explored fully in Chapter 4. In this chapter, we are going to look at all of the surrounding code
that supports these two classes to create a complete application.
37
 
Search WWH ::




Custom Search