How to set two different splash screen in cocos2d v3.x in ios

318 Views Asked by At

I'm working with the cocos2d 3.x and Xcode 5.1.1.I'm having two images image1.png and image2.png.In my game i already change the default image (splash screen) to my image(image1.png).Here i need to display image1.png for 2 seconds and the image2.png to display for next 3 seconds as a splash screen of my game...Thanks in advance..

1

There are 1 best solutions below

0
On

This is how i do this (to fade in and out a logo, after the default image has been served by iOS. I have a SplashLogo class (a scene). It is my startup scene, it puts up the logo, fades it out, then replaces itself as the running scene with my game controller.

- (void)onEnter {

    [super onEnter];

    self.positionType = CCPositionTypePoints;
    // todo : test this background seed, GL side effects, timing, etc ...    
    // [self performSelectorInBackground:@selector(seedGameSequencer) withObject:nil];

    [self seedGameSequencer];
    CCColor     *color = [CCColor colorWithRed:0 green:0.f blue:0.f alpha:0.f];
    CCNodeColor *black = [CCNodeColor nodeWithColor:color];
    black.positionType = CCPositionTypePoints;
    black.position    = ccp(0, 0);
    black.anchorPoint = ccp(0, 0); // bottom left
    [self addChild:black];


    [GESprite mediumPixelFormat];
    CCSprite *logo = [CCSprite spriteWithImageNamed:@"maxPowerStudiosLogo.png"];
    logo.positionType = CCPositionTypePoints;
    logo.anchorPoint = ccp(.5, .5);
    logo.opacity          = 0;
    logo.positionInPoints = ccp(black.contentSizeInPoints.width / 2, black.contentSizeInPoints.height / 2);

    [GESprite defaultPixelFormat];

    id fadein          = [CCActionFadeIn actionWithDuration:3 * K_FADE_TIME];
    id taponne         = [CCActionDelay actionWithDuration:.95];
    id fadeout         = [CCActionFadeOut actionWithDuration:2 * K_FADE_TIME];
    id swapSceneAction = [CCActionCallFunc actionWithTarget:self selector:@selector(swapScene)];
    id seq             = [CCActionSequence actions:fadein, taponne, fadeout, swapSceneAction, nil];

    // add the label as a child to this Layer

    [self addChild:logo];
    [logo runAction:seq];

}

- (void)seedGameSequencer {

    mainScene = [MPGameSequencer scene];
}

- (void)swapScene {

    [[CCDirector sharedDirector] replaceScene:mainScene];

}

and in AppDelegate :

- (CCScene *)startScene {
    // This method should return the very first scene to be run when your app starts.
    return [SplashLogo scene];
}