loading images causing jerk

Hi ,

In my app,images are created and they are moved on the screen continuously.

My problem is , when i am loading a new image, the ones already on the screen are facing a jerk.(They pause for a small time)

When i tried loading all the images previously and using them jerk is not there,but i can do that since it takes a lot of memory.

Also,this jerk reduces as the game progresses,and is completely gone after some time.

Any idea why this is happening ? And how to correct it?

Thanks.

Loading an image on a mobile device can take some time and cause FPS drop. That is why you see it pause for a small time. You could load textures in another thread so the main thread won’t slow down. There was some method like addImageAsync() for this.

Try using sprite sheets or batch nodes.

Yeah, you need to use sprite sheets. I have an example app that uses a sprite sheet:

http://www.gmtdev.com/blog/2011/08/19/how-to-use-box2d-for-just-collision-detection-with-cocos2d-x/

Hi

Thanks for all your replies.

Actually , i am loading ccbi nodes(from cocosbuilder), which internally contains large images.

can i still use sprite sheets?

i can try loading them in different thread

I’m not familiar with the ccbi files but you could try loading them in a pthread (type pthread in the search box above for some info).

I don’t think you can “create” the sprites in the pthread, only safe in the main thread, you might be ok depending on how Cocosbuilder works…