CCSpriteSheet と .png および .plist ファイルからアニメーション化する CCSpriteBatchNode を完全に実行していますが、別の CCAction を起動するためのアニメーションがどのフレームにあるかを知る方法はありますか??
たとえば、30 フレームの CCAnimation があり、アニメーションがフレーム 15 にあるときに別のスプライトをアニメーション化したいと考えています。これは可能ですか??
前もって感謝します。
CCSpriteSheet と .png および .plist ファイルからアニメーション化する CCSpriteBatchNode を完全に実行していますが、別の CCAction を起動するためのアニメーションがどのフレームにあるかを知る方法はありますか??
たとえば、30 フレームの CCAnimation があり、アニメーションがフレーム 15 にあるときに別のスプライトをアニメーション化したいと考えています。これは可能ですか??
前もって感謝します。
アニメーションをパーツに分割し、CCSequence を使用します。例えば:
CCAction *Action = [CCSequence actions:
                        [CCAnimate actionWithAnimation:myCCanimationPart1],
                        [CCCallBlock actionWithBlock:^
                         {
                            [myOtherSprite runAction:(otherAnimationAction)];
                         }],
                        [CCAnimate actionWithAnimation:myCCanimationPart2],
                        nil];
私は通常、私のゲームの1つからのこのコードフラグメントのようなもので、この種のニーズを満たします:
float stall;
CCAnimation *secondAnim;
CCSprite *secondSprite;
NSString *dyingFx;
id sound = (self.alive ? [GENoopAction action] : 
                         [GEPlayFx actionWithSoundFile:dyingFx]
            );
id second = [CCSequence actions:
        [CCDelayTime actionWithDuration:stall]
        , [CCShow action]
        , sound
        , [CCAnimate actionWithAnimation:secondAnim]
        , [CCCallFunc actionWithTarget:self selector:@selector(hurtComplete)]
];
secondSprite.visible= NO;
[secondSprite runAction:second];
GEPlayFx と GENoopAction は、私が自分用に作成したおもちゃです (CCActionInstant 実装)。