To create a scene class, use the following steps:
Create a new group called Scene.
Create a new Objective-C class called
Scene
, which is derived from theSPSprite
class, and save it in the Scene group.Add a property called
guiLayer
, which is aSPSPrite
type, as shown in the following code:@property SPSprite* guiLayer;
Add another property called
name
, which is anNSString
, as shown in the following code:@property NSString* name;
Add a third property called
director
, which is anid
, as shown in the following code:@property id director;
Add an initializer that initializes the properties of the class:
-(id) init { if ((self = [super init])) { self.guiLayer = [[SPSprite alloc] init]; self.director = nil; self.name = @"scene"; } return self; }
Add a second initializer that sets the name of the scene; this should be called
initWithName
:-(id) initWithName:(NSString *) name { self = [self init]; self.name = name...