【问题标题】:How to set two different splash screen in cocos2d v3.x in ios如何在 ios 的 cocos2d v3.x 中设置两个不同的启动画面
【发布时间】:2014-09-22 15:11:49
【问题描述】:

我正在使用 cocos2d 3.x 和 Xcode 5.1.1。我有两个图像 image1.png 和 image2.png。在我的游戏中,我已经将默认图像(启动画面)更改为我的图像( image1.png)。这里我需要将 image1.png 显示 2 秒,然后将 image2.png 显示为接下来的 3 秒作为我的游戏的启动画面...提前致谢..

【问题讨论】:

  • 哇,对于一个不清楚的问题,有很多人赞成!什么是“第一张图片”到“第二张图片”到“启动画面”到“默认图片”……它们是否以某种方式相关?什么情况下需要什么显示2秒,什么情况下需要另一个贴图显示3秒?

标签: ios5 cocos2d-iphone cocos2d-iphone-3


【解决方案1】:

我就是这样做的(在 iOS 提供默认图像之后淡入和淡出徽标。我有一个 SplashLogo 类(一个场景)。这是我的启动场景,它放置了徽标,将其淡出,然后用我的游戏控制器将其自身替换为正在运行的场景。

- (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];

}

在 AppDelegate 中:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-05
    • 2017-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多