2014-09-22 6 views
1

저는 cocos2d 3.x 및 Xcode 5.1.1을 사용하고 있습니다. 두 개의 이미지 image1.png와 image2.png가 있습니다. 내 게임에서 이미 기본 이미지 (스플래시 화면)를 내 이미지 (image1.png)로 변경합니다. 여기에 image1.png를 2 초 동안 표시하고 image2.png를 다음 3 초 동안 내 게임의 스플래시 화면으로 표시해야합니다. . 사전에 축하해.ios의 cocos2d v3.x에서 두 가지 다른 시작 화면을 설정하는 방법

+2

와우, 많이! '기본 이미지'로 '스플래시 화면'으로 '두 번째 이미지'로 '첫 번째 이미지'는 무엇입니까? .... 그들은 어떻게 든 관련이 있습니까 ??? 상황에 따라 2 초를 표시해야하며 3 초를 표시하기 위해 다른 질감이 필요한 상황이 있습니까? – YvesLeBorg

답변

2

이것은 기본 이미지가 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에210 : 명확하지 않은 질문에 대한 upvotes의

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