Brandon Lassiter
Brandon Lassiter

Reputation: 306

Cocos2D loading multiple scenes

I am creating a game and while implementing both iPhone 5 and non iPhone 5. In my app delegate I have the following:

CGSize winSize = [[CCDirector sharedDirector] winSize];
NSLog(@"Height: %f", winSize.height);
if(winSize.height == 568) {
    [[CCDirector sharedDirector] runWithScene:sceneI5];
    NSLog(@"Iphone 5 scene");
} else {
    [[CCDirector sharedDirector] runWithScene:scene];
    NSLog(@"Regular Scene");
}

Where the sceneI5 is a cocos2D scene specifically for the iPhone 5. What I am noticing is that both scenes start running for some reason i.e. sounds are played twice, and first the regular splash screen scene is loading and then immediately following this the iphone 5 splash screen is loaded. Can anyone help me figure out why this is happening?

Upvotes: 1

Views: 186

Answers (1)

Brandon Lassiter
Brandon Lassiter

Reputation: 306

Nevermind, I answered my own question and was a little bit too hasty to post it.

I changed the code in my app delegate to this:

CGSize winSize = [[CCDirector sharedDirector] winSize];
NSLog(@"Height: %f", winSize.height);
if(winSize.height == 568) {
    scene = [SplashScreenI5 scene];
    NSLog(@"Iphone 5 scene");
} else {
    scene = [SplashScreen scene];
    NSLog(@"Regular Scene");
}

[[CCDirector sharedDirector] runWithScene:scene];

Upvotes: 1

Related Questions