0

I'm going to add some SKAction animation before delete nodes from my SKScene. When I'm trying to do it, SKAction executed just at first 2-4 sprites from 10-40. If I commented [node runAction:action]; and just put [node removeFromParent]; all works fine. Can somebody help me, what I'm doing wrong here:

[self enumerateChildNodesWithName:@"dblock" usingBlock:^(SKNode *node, BOOL *stop) {
            TRBlock *droppedBlock = (TRBlock *)node;
            if ([linesToRemove containsIndex:droppedBlock.localCoordinates.y]) {
                //[node runAction:animationAction completion:^{
                    [node removeFromParent];
                //}];
            } else {
                if ([linesToRemove indexLessThanIndex:droppedBlock.localCoordinates.y] != NSNotFound) {
                    droppedBlock.localCoordinates = TRBoardCoordinatesMake(droppedBlock.localCoordinates.x,
                                                                           droppedBlock.localCoordinates.y - completeLines.count);
                    CGPoint targetPoint = calculatedPositionFromBlockBoardCoordinates(droppedBlock.localCoordinates);
                    droppedBlock.position = targetPoint;
                }
                //                [droppedBlock runAction:[SKAction moveToY:targetPoint.y duration:0.2]];
            }
        }];

as you can see all SKActions commented here and all works fine, but how I can do that with animation? I already tried a lot of different SKActions and even sequence and group, runWithCompletion: - same result, works for a few first SKNodes, but trying to run on dozens.

iiFreeman
  • 5,165
  • 2
  • 29
  • 42

0 Answers0