Game Development Reference
In-Depth Information
called the method or why. There's no context, but in many cases that context isn't
needed.
Caution Never use an Objective-C class (any id type) as the data parameter of
CCCallFuncND . Doing so runs the risk of leaking memory or crashing your
app in an ARC-enabled project. For id types, always use the CCCallFuncO
action or consider using the CCCallBlock actions later in this section be-
cause the block can use any variable that's in scope where the block is declared.
The action sequence seq will call the methods in the following code one after another.
The sender parameter will always be derived from CCNode —it's the node that's
running the actions. You can use the data parameter any way you want, including
passing values, structs, or other pointers. You only have to properly cast the data point-
er.
-(void) onCallFunc
{
CCLOG(@"end of tint1!");
}
-(void) onCallFuncN:(id)sender
{
CCLOG(@"end of tint2! sender: %@", sender);
}
-(void) onCallFuncO:(id)object
{
// object is the object you passed to CCCallFuncO
CCLOG(@"call func with object %@", object);
}
-(void) onCallFuncND:(id)sender data:(void*)data
{
CCLOG(@"end of sequence! sender: %@ - data: %p", sender, data);
}
Search Nedrilad ::




Custom Search