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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -