jquery - Unable to run animation -
trying run animation through loop, build succeeds fails perform animation on simulator, below code supposed perform animation
nsmutablearray *frames = [[nsmutablearray alloc]init]; //supposed loop through file names a0001 a0010 texture file. (int i=1; i<=10; i++) { nsstring *framename = [nsstring stringwithformat:@"a%04i.png",i]; [frames addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:framename]]; } // set frame speed ccanimation *a =[ccanimation animationwithspriteframes:frames delay:1.0f/24.0f]; // supposed use restoreoriginalframe method after actionwithanimation since deprecated removed [mole runaction:[ccanimate actionwithanimation:a]];
any highly appreciated, thank you
this how accomplish same thing. difference can see if not load images array, instead these textures loaded memory using sprite sheet.
nsstring * animatecycle = [nsstring stringwithformat:@"imagename 00%%02d.png"];
the image names along lines of "imagename 0001.png", "imagename 0002.png", , on.
ccactioninterval * action = [ccanimate actionwithspritesequence:animatecycle numframes:8 delay:.1 restoreoriginalframe:yes]; [mysprite runaction:action];
this cycle through images based on designated delay.
i hope helps.
Comments
Post a Comment