Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between CCCallFunc and CCCAllFuncN

Yeah, not sure I understand the difference. Because you can specify the target object by using CCCallFunc as well.

like image 441
stone Avatar asked Jul 26 '10 15:07

stone


1 Answers

CCCallFuncN passes the CCNode you called the action on to the method. For example if you need to run an action that removes the node from its parent you can use CCCallFuncN and then said method would look like this:

-(void)theCalledMethod:(CCNode *)thePassedNode
{
  [thePassedNode.parent removeChild:thePassedNode];
}

If you used a CCCallFunc instead you would have to keep a reference to said node in order to be able to retrieve it later and remove it in the called method.

like image 67
pabloruiz55 Avatar answered Oct 22 '22 17:10

pabloruiz55