-
Book Overview & Buying
-
Table Of Contents
Sparrow iOS Game Framework Beginner's Guide
By :
To create our scene manager setup, we need to follow these steps:
Open your Xcode game template if it's not already open.
Right-click on the Classes folder and select New Group.
Rename the group to GameScenes.
Create a new Objective-C class called PirateCove which is sub-classed from Scene.
Add an initializer with the following content:
if ((self = [super init])) {
NSLog(@"Pirate cove scene created");
}Create another Objective-C class which is sub-classed from Scene. Call this Battlefield.
Add an initializer with the following content:
-(id) init
{
if ((self = [super init])) {
NSLog(@"Battlefield scene created");
}
return self;
}Switch to the Game.m file.
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"
In the init method, create an instance of the PirateCove and Battlefield classes...
Change the font size
Change margin width
Change background colour