ios4 - Frame Rate per Second (FPS) starts to gdecrease in Coco2d game iPhone? -


i have 3 simple images each 2 hens (6 images) trying animate (a hen walking) using tutorial ray wenderlich:

http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

the animation works fine when start game after 2-3 mins frame rate begins drop , drops below 10 , application hangs.. btw using iphone 3g ios 4.1 ... can reason fps drop or iphone becomes idle after time?

[[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"hen.plist"];           ccspritebatchnode *spritesheet = [ccspritebatchnode batchnodewithfile:@"hen.png"]; [self addchild:spritesheet];  // load frames of our animation nsmutablearray *walkanimframes = [nsmutablearray array]; for(int = 1; <= 3; ++i) {     [walkanimframes addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:[nsstring stringwithformat:@"%d.png", i]]]; } ccanimation *walkanim = [ccanimation animationwithframes:walkanimframes delay:0.1f];  self.bear = [ccsprite spritewithspriteframename:@"1.png"];         _bear.position = ccp(20,400); self.walkaction = [ccrepeatforever actionwithaction:[ccanimate actionwithanimation:walkanim restoreoriginalframe:no]]; [_bear runaction:_walkaction]; [spritesheet addchild:_bear];  [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"monkey.plist"];           ccspritebatchnode *spritesheetmonkey = [ccspritebatchnode batchnodewithfile:@"monkey.png"]; [self addchild:spritesheetmonkey];  nsmutablearray *walkanimframesmonkey = [nsmutablearray array]; for(int = 1; <= 3; ++i) {     [walkanimframesmonkey addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:[nsstring stringwithformat:@"%d.png", i]]]; } ccanimation *walkanimmonkey = [ccanimation animationwithframes:walkanimframesmonkey delay:0.1f];   self.monkey = [ccsprite spritewithspriteframename:@"1.png"];         _monkey.position = ccp(40,80); self.walkmonkey = [ccrepeatforever actionwithaction:[ccanimate actionwithanimation:walkanimmonkey restoreoriginalframe:no]]; [_monkey runaction:_walkmonkey]; [spritesheetmonkey addchild:_monkey]; float bearvelocity = 480.0/3.0;  cgpoint movedifferencehen = ccpsub(henloction, _bear.position); float distancetomovehen = ccplength(movedifferencehen); float movedurationhen = distancetomovehen / bearvelocity;  self.moveaction = [ccsequence actions:                                                  [ccmoveto actionwithduration:movedurationhen position:henloction],                        [cccallfunc actionwithtarget:self selector:@selector(bearmoveended)],                        nil                        ];   [_bear runaction:_moveaction];  

sounds might have memory leak. advice run leaks , objectalloc instruments on device. also, should post relevant code if want more detailed assistance.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -