Book Image

Sparrow iOS Game Framework Beginner's Guide

By : Johannes Stein
Book Image

Sparrow iOS Game Framework Beginner's Guide

By: Johannes Stein

Overview of this book

Table of Contents (20 chapters)
Sparrow iOS Game Framework Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Afterword
Index

Time for action – creating our scene manager setup


To create our scene manager setup, we need to follow these steps:

  1. Open your Xcode game template if it's not already open.

  2. Right-click on the Classes folder and select New Group.

  3. Rename the group to GameScenes.

  4. Create a new Objective-C class called PirateCove which is sub-classed from Scene.

  5. Add an initializer with the following content:

    if ((self = [super init])) {
      NSLog(@"Pirate cove scene created");
    }
  6. Create another Objective-C class which is sub-classed from Scene. Call this Battlefield.

  7. Add an initializer with the following content:

    -(id) init
    {
        if ((self = [super init])) {
            NSLog(@"Battlefield scene created");
        }
        
        return self;
    }
  8. Switch to the Game.m file.

  9. Add the PirateCove.h, Battlefield.h, and SceneDirector.h files to the import section, as shown in the following code:

    #import "SceneDirector.h"
    #import "PirateCove.h"
    #import "Battlefield.h"
  10. In the init method, create an instance of the PirateCove and Battlefield classes...