2016-06-01 5 views

답변

0

로드와 장면/레이어 :

auto animTimeline = CSLoader::createTimeline("file.csb"); 
node->runAction(animTimeline); 
animTimeline->gotoFrameAndPlay(0, true); 

당신이 층 올바른 자식 노드를 찾을 포함 된 경우, 해당 타임 라인과 놀이를로드

auto node = CSLoader::createNodeWithVisibleSize("file.csb"); 

로드 애니메이션 타임 라인과 함께 플레이 다음을 포함합니다 :

node->enumerateChildren("//child", [=](Node* _node) 
{ 
    auto animTimeline = CSLoader::createTimeline("child.csb"); 
    _node->runAction(animTimeline); 
    animTimeline->gotoFrameAndPlay(0, true); 
    return true; 
}); 

(사용법은 CCNode.h의 Node :: enumerateChildren() 참조) 꼬리)

+0

답장을 보내 주셔서 감사합니다.하지만 제가 찾고있는 것이 아닙니다. Cocos Studio에서는 많은 애니메이션을 만들었고 각 애니메이션은 여러 스프라이트 시트에서 만들어졌습니다. 예를 들어 나는 anim1, anim2, anim3을 가지고 있습니다 ... 어떻게 anim1을로드하고 C++에서 재생할 수 있습니까? –

+1

타임 라인 액션을 통해 이름으로 애니메이션을 재생할 수도 있습니다 : animTimeline-> play ("anim1", loop); (https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h) –