ccaction - Cocos2D V3 does not have CCCallFuncND How pass structure address to selector? -
with cocos2d v3 after action has completed on sprite need update data contained in structure. how can pass data structure address selector executes after sprite action has completed? appreciated.
you use ccactioncallblock
or ccactioncallfunc
. whichever appropriate use case.
here code example of block being called after move action.
ccactionmoveby* movetosomeawesomeplace = [ccactionmoveby actionwithduration:0.1f position:cgpointzero]; ccactioncallblock *actionaftermoving = [ccactioncallblock actionwithblock:^{ self.someproperty = 42; }]; ccactionsequence *movingsequeceandotherstuffafter = [ccactionsequence actionwitharray:@[movetosomeawesomeplace, actionaftermoving]]; [self runaction:movingsequeceandotherstuffafter];
and here example using ccactioncallfunc
executes selector after move action.
ccactionmoveby* movetosomeawesomeplace = [ccactionmoveby actionwithduration:0.1f position:cgpointzero]; ccactioncallfunc *callaftermoving = [ccactioncallfunc actionwithtarget:self selector:@selector(somemethod)]; ccactionsequence *movingsequeceandotherstuffafter = [ccactionsequence actionwitharray:@[movetosomeawesomeplace, actionaftermoving]]; [self runaction:movingsequeceandotherstuffafter];
Comments
Post a Comment