I'm posting solutions for both Cocos2d and Cocos2d-x, because everyone should switch to cocos2d-x because it compiles for both iOS and Android with no extra porting, and just in case someone using Cocos2d-x runs across this same issue.
In Cocos2d-x I would call the function from a meta:
Sequence::create(MoveTo::create(1.0, Point(100, 200))),
CallFunc::create([&](){HelloWorld::myFunction()},
null);
In Cocos2d I would do this:
[CCSequence actions:
[CCMoveTo actionWithDuration:1.0 position:ccp(100, 100)],
[CCCallFuncN actionWithTarget:self selector:@selector(myFunction:)],
nil];
If you don't want to put it in a function (like it's just a one time use), following your style, you SHOULD be able to do it like this:
CCActionMoveTo *moveTo = [CCActionMoveTo actionWithDuration:0.2f position:nextPosition];
CCActionRemove *remove = [CCActionRemove action];
CCAction *particles = [CCCallBlock actionWithBlock:^{
CCParticleSystem *mergePart1 = (CCParticleSystem *)[CCBReader load:@"MergePart1"];
mergePart1.autoRemoveOnFinish = TRUE;
mergePart1.position = mySprite.position;
[game.parent addChild:mergePart1];
}];
CCActionSequence *sequence = [CCActionSequence actionWithArray:@[moveTo,remove,particles]];
[mySprite runAction:sequence];
That will work in a sequence. (I'm a little uncertain about defining the particle action separately though, there's a few funny things about defining stuff that calls on other objects outside of the scope of the object).
Personally, I don't like to define stuff before I call it if I'm only going to call it once, I would use CCSequence with Actions like so:
[mysprite runaction:[CCSequence actions:
[CCMoveTo actionWithDuration:0.2f position:nextPosition],
[CCActionRemove action], //not sure what this does
[CCCallBlock actionWithBlock:^{
CCParticleSystem *mergePart1 = (CCParticleSystem *)[CCBReader load:@"MergePart1"];
mergePart1.autoRemoveOnFinish = TRUE;
mergePart1.position = mySprite.position;
[game.parent addChild:mergePart1];
}],
nil
]];