我正在使用 cocos2d 和 cocosBuilder。我正在尝试做一个开始动画,然后一旦它完成,让所有的子节点执行他们的空闲动画。
我是如何做开始动画的:
(无效) onEnter {
[super onEnter];
CCLOG(@"onEnter being called");
// Schedule a selector that is called every frame
[self schedule:@selector(update:)];
// Make sure touches are enabled
self.touchEnabled = YES;
//intro animation
CCBAnimationManager* animationManager = self.userObject;
animationManager.delegate = self;
[animationManager runAnimationsForSequenceNamed:@"words"];
}
这就是我的 completedAnimationSequenceNamed 的样子:
(void) completedAnimationSequenceNamed:(NSString *)name{
CCLOG(@"animation ended");
for(CCNode *c in [self children])
{
if([c isKindOfClass:[GameObject class]])
[c playIdleAnimation];
}
}
出于某种原因,我的 completedAnimationSequenceNamed 被重复调用,每秒多次,导致我的孩子不断地重新启动他们的空闲动画。
有任何想法吗?