2014-03-26 3 views
0

작업이 코드를 실행하지 않는 새로운 장면으로 전환하기 전에 조치를 실행할 수 없습니다 : 내가 전환 뉴욕을 언급하는 경우스프라이트 키트

SKAction *moveLeft = [SKAction moveToX:(-800) duration:0.6]; 
SKAction *moveRight = [SKAction moveToX:(800) duration:0.6]; 
[_labelLogo runAction:moveLeft]; 
[_labelPlay runAction:moveRight]; 

NewYork *start = [[NewYork alloc] initWithSize:self.size]; 
SKTransition *reveal = [SKTransition fadeWithColor:[UIColor clearColor] duration:2]; 
reveal.pausesIncomingScene = NO; 

[self.scene.view presentScene: start transition: reveal]; 

가 작동합니다. 당신이 그 * moveLeft/*었던 MovieRight이 같은 완료 기다려야하므로

+0

내 편집 대답을 확인 – Ilario

답변

3

행동 * moveLeft/*었던 MovieRight에 대한 문제는, 그 때문에, 뉴욕 현장에 바로 전환을 시작합니다

SKAction *moveLeft = [SKAction moveToX:(-800) duration:0.6]; 
SKAction *moveRight = [SKAction moveToX:(800) duration:0.6]; 
[_labelLogo runAction:moveLeft]; 

[_labelPlay runAction:moveRight completion:^{ 

    NewYork *start = [[NewYork alloc] initWithSize:self.size]; 
    SKTransition *reveal = [SKTransition fadeWithColor:[UIColor clearColor] duration:2]; 
    reveal.pausesIncomingScene = NO; 

    [self.view presentScene:start transition:reveal]; 
}]; 
+1

self.scene.view (모든 노드) 또는 self.view (장면)는 둘 다 노드 클래스에 따라 작동합니다. – LearnCocos2D

+0

@ LearnCocos2D 의견과 upvote에 감사드립니다. "노드 클래스가 무엇입니까?" 예를 들면? 다시 고마워. – Ilario

+0

나는 당신이 [self.scene.view presentScene : start transition : reveal]; 또는 [self.view presentScene : 시작 전환 : 공개]; 무엇이든간에 전혀 차이가 없습니다. 후자를 SKScene 클래스가 아닌 노드 객체에서 수행하려고 시도하지 않는 한, 컴파일 오류가 발생합니다 (SKScene에만 view 속성이 있으며 다른 모든 노드는 self.scene.view를 거쳐야합니다). – LearnCocos2D