Cocos2d - 结合CCSequence和Bool!可能吗

时间:2013-05-24 08:24:07

标签: cocos2d-iphone

我想问一下是否可以将ccsequence和bool结合起来?

[self runAction:[CCSequence actions:
                 myAnimation,
                 (myBool = YES),
                 [CCDelayTime actionWithDuration:myTime],
                 [CCCallFunc actionWithTarget:self selector:@selector(otherAnimation)],
                 nil]];

但如果我这样做,程序就会崩溃。

有人知道解决方案吗?

1 个答案:

答案 0 :(得分:2)

你是在正确的方式,你可以像这样改变你的行动

[self runAction:[CCSequence actions:
                 myAnimation,
                 //OLD_VERSION(myBool = YES), 
                 [CCCallFunc actionWithTarget:self selector:@selector(yourBoolMethod)], 
                 [CCDelayTime actionWithDuration:myTime],
                 [CCCallFunc actionWithTarget:self selector:@selector(otherAnimation)],
                 nil]];

yourBoolMethod内部将bool设置为true

-(void) yourBoolMethod {
      myBool = YES:
}