now, did this. 12 animations move @ same time.
(sorry, can't upload image. so, did it. |~| 1 line , 3x4 matrix)
| 1 1 1 | | 1 1 1 | | 1 1 1 | | 1 1 1 |
but, want this.
ex) there 12 pannel foward order upper left corner 1, 2, 3, ... , 12
so, animation moves 1, 2, 3 periods of time, not same time.
| 1 2 3 |
// this.
i did search internet , added some. but, couldn't moving that. how can them.
here code.
ccsprite* maker_sh = ccsprite::create("img/marker_sh.jpg") ; ccanimation* sh_ani = ccanimation::create() ; sh_ani -> setdelayperunit(0.05) ; for(int = 0 ; < 24 ; i++) { int index = % 5 ; int rowindex = / 5 ; sh_ani -> addspriteframewithtexture(maker_sh -> gettexture(), ccrectmake(index * 120, rowindex * 120, 120, 120)) ; } ccanimate* animate[12] ; ccaction* rep[12] ; for(int = 0 ; < 12 ; i++) { animate[i] = ccanimate::create(sh_ani) ; rep[i] = ccrepeatforever::create(animate[i]) ; } int cnt = 0 ; ccsprite* test[12] ; for(int = 3 ; > -1 ; i--) for(int j = 0 ; j < 3 ; j++) { cnt++ ; test[j + (3 - i) * 3] = ccsprite::createwithtexture(maker_sh -> gettexture(), ccrectmake(0, 0, 120, 120)) ; test[j + (3 - i) * 3] -> setposition(ccp(j * 125 + 120, i*125 + 75)) ; -> addchild(test[j + (3 - i) * 3]) ; test[j + (3 - i) * 3] -> runaction(rep[j + (3 - i) * 3]) ; cclog("%d", cnt) ; }
not smart way,just hope give :)
ccanimate* animate[12]; ccaction* rep[12]; float interval = 3.f;//set value need (int i=0; i<12; i++) { ccdelaytime* delay = ccdelaytime::create(i*interval); animate[i] = ccanimate::create(sh_ani); ccaction* action = ccrepeatforever::create(animate[i]) ; rep[i] = ccsequence::create(delay,action); }
Comments
Post a Comment