iphone - getting sender object in cocos2d -


i making game using cocos2d. using following code,i have added animation.how send ccsprite reference?

if(sprite != monkey) {     [self scheduleonce:@selector(animate_sprite:) delay:0.1f]; }  -(void)animate_sprite:(cctime) dt {     id s2 = [ccscaleto actionwithduration:0.5 scalex:2.0 scaley:2.0];     id fun = [cccallfuncn actionwithtarget:self selector:@selector(spritedone:)];     [sprite runaction:[ccsequence actions:s2,fun,nil]]; } 

how sprite reference in animate_sprite method?

you can use performselector:withobject:afterdelay same thing.

if(sprite != monkey) {     [self performselector:@selector(animate_sprite:) withobject:sprite afterdelay:0.1f]; }  -(void)animate_sprite:(ccsprite *)sprite {      id s2 = [ccscaleto actionwithduration:0.5 scalex:2.0 scaley:2.0];     id fun = [cccallfuncn actionwithtarget:self selector:@selector(spritedone:)];     [sprite runaction:[ccsequence actions:s2,fun,nil]]; } 

so edit method use sprite , not cctime object since not using @ all.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -