块来救援!!!:)
id action = [CCScaleTo actionWithDuration:0.5 scaleX:self.Xposition scaleY:1];
id ease = [CCEaseInOut actionWithAction:action rate:4];
id call = [CCCallBlockN actionWithBlock:^(CCNode* node) {
// node is the sprite, you may have to cast it:
CCSprite* someSprite = (CCSprite*)node;
// do whatever you need to do with sprite here…
someSprite.opacity = CCRANDOM_0_1() * 255;
}];
id sequence = [CCSequence actions:action, ease, call, nil];
[someObject[i] runAction:sequence];
或者,您也可以简单地使用 someObject[i] 数组,甚至可以访问其他精灵:
id action = [CCScaleTo actionWithDuration:0.5 scaleX:self.Xposition scaleY:1];
id ease = [CCEaseInOut actionWithAction:action rate:4];
id call = [CCCallBlock actionWithBlock:^{
CCSprite* someSprite = someObject[i];
CCSprite* firstSprite = someObject[0];
// do whatever you need to do with sprite here…
}];
id sequence = [CCSequence actions:action, ease, call, nil];
[someObject[i] runAction:sequence];