O'Reilly logo

Learning Objective-C by Developing iPhone Games by Amy M. Booker, Joseph D. Walters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning the game state

Let's pick up the AlienInvaders game we started putting together in the previous chapter. In this chapter, we are going to set up our game to have its own state machine. If we go back and look over the GameViewController code from the previous chapter, you will notice that everything that we put in here doesn't really have anything to do with the game itself; it is all about the player. That doesn't make any sense if we want our player to have its own state machine and the game to have its own state machine. Let's start by performing the following steps:

  1. Create a new player class and move everything for the player out of GameViewController.
  2. Create a new class for EnemyBullet under your File menu and add a new file.
  3. Choose ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required