icethawless
icethawless

Reputation: 95

How to draw multi CCSprite object use one image?

I want to draw some sprites in the screen, using CCSprite in cocos2d. But if I init each CCSprites with [MySprite spriteWithFile:@"MyImage.png"],and each sprite only use part of the image, will the image be loaded into memory many times? As memory resource is very limited and the size of the image is big(1024*1024), is there anyway to make sure the image is loaded only once? And how to init the CCSprites so as to make each sprites be part of the image?

Upvotes: 0

Views: 563

Answers (1)

pob21
pob21

Reputation: 1928

Yes there actually is. You cached your spritesheet, correct? This newer method of loading sprites does just that, by them being cached you don't have to worry about multiple sprites weighing heavily on your resources.

Upvotes: 0

Related Questions