iphone - crash on animating the sprite from sprite sheet -
below code using
-(void)addsprites{ [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"image.plist"]; ccspritebatchnode *spritesheet = [ccspritebatchnode batchnodewithfile:@"image.png"]; [self addchild:spritesheet]; // load frames of our animation nsmutablearray *walkanimframes = [nsmutablearray array]; for(int = 1; < 5; i++) { [walkanimframes addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:[nsstring stringwithformat:@"image%d.png", i]]]; } // ccanimation *walkanim = [ccanimation animationwithframes:walkanimframes delay:0.1f]; ccanimation *walkanim = [ccanimation animationwithspriteframes:walkanimframes delay:0.20f]; // create sprite our bear background = [ccsprite spritewithspriteframename:@"image1.png"]; background.position = ccp(280, 175); self.walkaction = [ccrepeatforever actionwithaction:[ccanimate actionwithanimation:walkanim]]; //[_bear runaction:_walkaction]; [spritesheet addchild:background]; } -(void)startanimation{ [background runaction:walkaction]; }
but app crash on line
[background runaction:walkaction];
the error message ccspriteframecache: trying use file 'fisherman.png' texture 2013-05-03 13:30:44.085 * assertion failure in -[ccsprite runaction:]terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'argument must non-nil'. tried calling action
[background runaction:walkaction];
in -(void)addsprites{......} method still crash occurs same error.
can please me on issue?
Comments
Post a Comment