We now have three layers for our game, and some layers need to know about the others. Nothing can be a child of the playfield layer, due to the scrolling issue. This is exactly the type of situation that causes us to prefer the separation of scene and layer files, unlike the common template format (a scene method embedded in the CCLayer
class). If we were to do that, in which class would you include the scene method, since there is really not one parent layer? (Some would argue that the HUD should be the master layer, with others as children of it. Technically, that works too. We're not fans of that structure, however). Our solution is in the construction of the TDPlayfieldScene
class.
@implementation TDPlayfieldScene +(id) sceneWithTiltControls:(BOOL)isTilt { return [[[self alloc] initWithTiltControls:isTilt] autorelease]; } -(id) initWithTiltControls:(BOOL)isTilt { if( (self=[super init...