The CCCallFunc Action allows you to call a method from an action. Can be useful at the end of a sequence action.

There are two variations of CCCallFunc. They are CCCallFuncN and CCCallFuncND.

CCCallFuncN takes the node as an argument, and CCCallFuncND takes the node and a pointer to some data.

id actionCallFuncN = [CCCallFuncN actionWithTarget:self selector:@selector(doATaskN:)];

id actionCallFuncND = [CCCallFuncND actionWithTarget:self selector:@selector(doATaskND:data:) data:pointerToSomeData];

- (void) doATaskN: (id)node
{
//Your code goes here...
}

- (void) doATaskND: (id)node data:(void*)d
{
//Your code goes here...
}

Filed under: Cocos2diPadiPhone

Like this post? Subscribe to my RSS feed and get loads more!