cocos2d-iphoneccaction

Is it possible to run a fadeOut action half way through a move action?


I am wondering if it is possible to run a fadeOut action half way through a moveTo action all on the same node. Here is my code:

id show = [CCShow action];
id move = [CCMoveTo actionWithDuration:2.5f position:ccp(70, 275)];
id seq = [CCSequence actions:show, move, nil];
id fade = [CCFadeOut actionWithDuration:2.5f];
id spawn = [CCSpawn actions:seq, fade, nil];
[extraTime runAction:spawn];

I need to be able to run the fade action half way through the move action if that is possible. Any help or suggestions would be appreciated.


Solution

  • stall the fade like this

    id delayFade = [CCDelayTime actionWithDuration:1.25];
    id stallAndFade = [CCSequence actions:delayFade,fade,nil];
    

    and modify your spawn to:

    id spawn = [CCSpawn actions:seq,stallAndFade,nil];
    

    ob cit. (not tested, from menory, cocos2d 2.0)