Reputation: 4721
Is there a way outside there to convert a bunch of sprite images already running in a cocos2d game to an atlas. Searching for a way to do it authomatically without touching the existing source code.
Upvotes: 0
Views: 202
Reputation: 1042
You can check out an application called Texture Packer. With it you can create sprite sheets (another word for atlas really) and in code you can use
CCSprite* sprite = [CCSprite spriteWithSpriteFrameName:@"image_name"];
rather than
CCSprite* sprite = [CCSprite spriteWithFile:@"image.png"];
Before you create sprites, you'll need to add the sprite sheet's plist file from Texture Packer:
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"sheet.plist"];
I hope this helped.
Upvotes: 1