objective c - Cocos2D: Multiple actions: CCMoveTo CCAnimate -
i don´t understand, absolutely cannot work, want sequence of actions plays animation , moves sprite using ccanimate
ans ccmoveto
classes. there bug or special these classes, cause not move nor animate when stringing in ccsequence of actions this.
action = [ccsequence actions: [ccmoveto actionwithduration:moveduration position:touchlocation], [ccanimate actionwithanimation:self.walkinganim], [cccallfunc actionwithtarget:self selector:@selector(objectmoveended)], nil]; [self runaction:action];
i
if want move , animate action run paralel can use:
option1: use ccspawn instead of ccsequence. ccsequence needed because call function after completion.
id action = [ccspawn actions: [ccmoveto actionwithduration:moveduration position:touchlocation], [ccanimate actionwithanimation:self.walkinganim], nil]; id seq = [ccsequence actions: action, [cccallfunc actionwithtarget:self selector:@selector(objectmoveended)], nil]; [self runaction:seq];
option2: add action multiple times , run in paralel. because of func-call ccsequence again needed:
id action = [ccsequence actions: [ccmoveto actionwithduration:moveduration position:touchlocation], [cccallfunc actionwithtarget:self selector:@selector(objectmoveended)], nil]; [self runaction:action]; [self runaction:[ccanimate actionwithanimation:self.walkinganim]];
Comments
Post a Comment