O'Reilly logo

Sparrow iOS Game Framework Beginner's Guide by Johannes Stein

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

Time for action – managing our scenes with a scene director

To create the scene director, take a look at the following steps:

  1. Create a new Objective-C class called SceneDirector, which is derived from the SPSprite class, and save it in the Scene group.
  2. Add an instance variable called _dict, which is an NSMutableDictionary type.
  3. Add an instance method that will add a scene to the scene director, as shown in the following code:
    -(void) addScene:(Scene *)scene;
  4. Add a second instance method that will add a scene, but this time you are also able to define/overwrite the name of the scene:
    -(void) addScene:(Scene *)scene withName:(NSString *)name;
  5. Add an instance method that will show a scene and take NSString as its parameter, as shown in the following code: ...

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