0

シーケンスの最後にremoveAllChildrenWithCleanup:を追加するまで、正常に機能する変換シーケンスがあります。変換シーケンスを保持し、最後にremoveAllChildrenWithCleanup:を実行するにはどうすればよいですか?

問題のコードのスニペットは次のとおりです。

// Note: spriteSheet is a CCSpriteBatchNode
CCArray *oldSprites = [spriteSheet descendants];
for (int j=0; j < (int)[oldSprites count]; j++) {
    CCSprite *sprite = (CCSprite *)[oldSprites objectAtIndex:j];
    if (sprite != nil) {
        id actionMove = [CCMoveTo actionWithDuration:0.75
                                            position:ccp(0,0)];
        [sprite runAction:actionMove];
    }
}
[spriteSheet removeAllChildrenWithCleanup:YES];

注:CCMoveTo、CCCallFuncNDのシーケンスを使用してスプライトをクリーンアップしようとしましたが、どちらも機能しません。CCSpriteBatchNodeから子を削除するのは非常に遅いことがわかっているので、removeAllChildrenWithCleanup:を使用しようとしています。

4

1 に答える 1

1

CCCallBlockを試しましたか?このようなもの:

id actionMove = [CCMoveTo actionWithDuration:0.75 position:ccp(0,0)];
id actionDelay = [CCCallBlock actionWithBlock:^{[sprite removeFromParentAndCleanup:YES]; }];
id sequence = [CCSequence actions:actionMove, actionDelay, nil];
[sprite runAction:sequence];
于 2012-10-20T21:48:29.917 に答える