COCOS2D在动画后消失精灵

时间:2012-07-09 05:33:00

标签: ios cocos2d-iphone

我正在设计一个测验。想要动画错误的答案精灵2-3秒。然后它应该自动消失。我怎么能这样做?

1 个答案:

答案 0 :(得分:3)

CCFadeOut *fade = [CCFadeOut actionWithDuration:3];  //this will make it fade
CCCallFuncN *remove = [CCCallFuncN actionWithTarget:self selector:@selector(removeSprite:)];
CCSequence *seq = [CCSequence actions: fade, remove, nil];
[mySprite runAction:seq];

这是我们上面分配的CCCallFuncN对象调用的方法。

-(void) removeSprite:(id)sender 
{
[self removeChild:sender cleanup:YES];
}

希望这有帮助。欢呼!