Cocos2D SpriteSheet animation issue, frame count is much larger

I am trying to use SpriteSheet to trigger an animation. My frames are 320x480 each, so I can place up to 6 frames on the texture image. But my animation consists of a number of frames ranging from 50 to 200, and they are all 320x480. But this number of frames cannot be added to the texture image since the size is limited to 1024x1024. Is there any other approach I can try. Can I play one animation after another. And will it not hinder performance. Please, I need suggestions. Best, Vaibhav Tekam.

+2


a source to share


1 answer


Wow, you're past what the device can handle! You will have to reconsider what you are trying to achieve and how to achieve it. Let me explain.

Each 1024x1024 texture with 32-bit colors requires 4MB of memory. If you want a sprite animation of 60 full-screen sprites, you need 10 of these textures. This amounts to 40 MB of memory. Or 120MB for your uppercase script with 180 frames of animation.



Keep in mind that 128MB RAM memory models on iOS devices have around 30MB of memory available for your app, at best and in ideal conditions. You will start to run into memory problems with only five 1024x1024 textures. 256MB devices still only have about 100MB for your app.

Since it must be an animation, it also cannot load one texture, and after every sixth image, delete this texture and load the next one. Loading a 1024x1024 texture into memory takes about 1-3 seconds depending on the device. Your application will be irresponsible during this time.

+2


a source







All Articles