Getting started: TexturePacker and cocos2d-swift

This overview shows you how to create your first sprite sheet and import it into your cocos2d-swift project.

These easy steps will cost you only 5 minutes - but make your development much easier. Promised!

Open TexturePacker, select cocos2d as framework.

TexturePacker: Select cocos2d as framework

Add sprites ...

Drag & drop sprites
onto TexturePacker.

... or folders

TexturePacker adds
all sprites inside the folder
and updates the texture
when the content changes.

Add Sprites to TexturePacker

Set output files
Make sure to set the output path of both files so that the images can be reached from your project.

Set the output path for your files

Click Publish sprite sheet to write the sprite sheet to your Cocos2D-Swift project.

TexturePacker: Click Publish sprite sheet

Add texture and plist file to your project.

Add files to your cocs2d project

Preload texture data

[[CCSpriteFrameCache sharedSpriteFrameCache]
    addSpriteFramesWithFile: @"spritesheet.plist"];

Create sprites

CCSprite *sprite = [CCSprite spriteWithImageNamed:@"sprite.png"];
[self addChild:sprite];

Do you want to read more?

Head over to our Cocos2d tutorials section.

Do you have any feedback or questions?