2013-06-06 2 views
0

나는 두 개의 서로 다른 스프라이트를 가지고 있는데, 나는 링크와 코드를 따라 가면서 세 번째 스프라이트 위에 함께 바인딩하고있다. 그러나이 새로운 상위 스프라이트에는 CCAction이 실행되지 않습니다. 스프라이트를 하나로 결합하고 단일 본문에서 동작을 수행하는 방법은 무엇입니까 ??단일 CCSprite에서 하위 스프라이트 관리?

당신이 자식 항목을 애니메이션을 적용 할 경우

combining-multiple-ccsprites

fatherSprite = [CCSprite node]; 
[fatherSprite setPosition:ccp(75,265)]; 

CCSprite *fatherBody = [CCSprite spriteWithFile:@"father-character.png"]; 
     [fatherBody setPosition:CGPointZero]; 
     [fatherSprite addChild:fatherBody]; 

CCSprite * fatherFace = [CCSprite spriteWithCGImage:image.CGImage key:nil]; 
     [fatherFace setPosition:ccp(83,80)];//277+image.size.height/4)]; 
     [fatherSprite addChild:fatherFace]; 

     [self addChild:fatherSprite]; 

답변

1

를 작동하지 않았다 .. fatherSpriteCCFadeIn 조치를 시도, 당신은 부모에게하지 말라고에 애니메이션을 적용해야 . 그래서 그냥 모든 차일을 반복하고 애니메이션을

같은 방식으로 부모의 불투명도 0을 설정하려는 경우, 당신은 제로

예에 차일을 통해 루프 설정 알파해야합니다

for(CCSprite *sprite in container.children) 
      [sprite runAction:[CCFadeIn actionWithDuration:0]];