Game Development Reference
In-Depth Information
When using an action sequence, you may want to be notified at certain times, for ex-
ample when the sequence has ended, and then perhaps start another sequence immedi-
ately thereafter. To do that, you can make use of several versions of CCCallFunc ac-
tions that'll send a message whenever it's their turn in the sequence. Let's rewrite the
color cycle sequence so that it calls a method each time one of the CCTintTo actions
has done its job:
// sends a message to target using selector with this signature:
// -(void) onCallFunc;
CCCallFunc* func = [CCCallFunc actionWithTarget:self
selector:@selector(onCallFunc)];
// sends a message to target using selector with this signature:
// -(void) onCallFuncN:(id)sender;
CCCallFuncN* funcN = [CCCallFuncN actionWithTarget:self
selector:@selector(onCallFuncN:)];
// Caution: avoid using this due to ARC issues.
// sends a message to target using selector with this signature
// -(void) onCallFuncND:(id)sender data:(void*)data;
CCCallFuncO* funcO = [CCCallFuncO actionWithTarget:self
selector:@selector(onCallFuncO:)
object:self];
// sends a message to target using selector with this signature:
// -(void) onCallFuncO:(id)object;
void* someDataPointer = nil;
CCCallFuncND* funcND = [CCCallFuncND actionWithTarget:self
selector:@selector(onCallFuncND:data:)
data:someDataPointer];
CCSequence* seq = [CCSequence actions: ←
tint1, func, tint2, funcN, tint3, funcO, funcND, nil];
[label runAction:seq];
The difference between these variants of CCCallFunc is in which selector they call
and thus which context is available to the method they call. For example, when
CCCallFunc calls the onCallFunc method, you have no way of knowing who
Search Nedrilad ::




Custom Search