tags:

views:

80

answers:

2
- (BOOL) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
 CocosNode* spHead = [self getChildByTag:tagHead];
 CocosNode* spBody = [self getChildByTag:tagBody];

 [spHead runAction:fadeOutAction];
 [spBody runAction:fadeOutAction];
}

as the code above, i want the sprites to do some action at the same time, the second one works exactly, but the first one doesn't.

Need help.Anyone can help me?

A: 

Your fadeOutAction doesn't handle reentrancy?

mahboudz
I want them fade out and disppear.
holsety
I mean you can't call your fadeOutAction until the first one has completed. It is not-stateless, and if you call it a second time while still running, it will reset the first one. That may be why it doesn't work and having two different methods does.
mahboudz
A: 

i know

  • (BOOL) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent )event { CocosNode spHead = [self getChildByTag:tagHead]; CocosNode* spBody = [self getChildByTag:tagBody];
    [spHead runAction:fadeOutAction];
    [spBody runAction:[[fadeOutAction copy] autorelease]];

}

then ok

holsety