views:

124

answers:

2

Hi, I have a sprite which i animate using CCAnimate. the animation is composed of 4 spritesheets that i swap when needed. everything works pretty good except for some flickering when swapping spritesheets.

any ideas on what to do?

+1  A: 

i've found a solution in case anyone is interested.

it seems theres a lag when switching between CCAnimation objects, that make the frame be blank for a split second. the solution is to manually set the sprite to the first frame of the coming animation immediately after ditching the old one.

more info here: http://www.cocos2d-iphone.org/forum/topic/8729

Hezi Cohen
I haven't run into this yet, but I expect to. Thanks.
Justin
A: 

Do you preload the spritesheets using CCTextureCache's addImage? If not, you'll notice a lag whenever you switch to a spritesheet for the first time.

Also, unless your spritesheets are so big that you can't fit all animations into a 1024x1024 texture you should simply put all of the sprites into one sheet, instead of using multiple like for example four 256x256 spritesheets. You hardly gain anything from doing that, at worst you lose the benefit of spritesheets because as soon as you render from two different spritesheets it'll be two draw calls instead of one. Texture atlases are not for organizing your animations but to keep as much as possible of all of your graphics into as few as possible textures.

GamingHorror
My animation is too big to fit in a 1024x1024 that's why i'm using 4 spritesheets. i've been using CCSpriteFrameCache's addSpriteFramesWithFile to load my spritesheets in my intro scene, i see it uses addImage so i'm guessing this is the same. i was wondering about addImageSync and how to use it with addSpriteFramesWithFile, any ideas? I'm currently suffering from long load times...
Hezi Cohen