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!

1.
Open TexturePacker, select cocos2d as framework.

TexturePacker: Select cocos2d as framework

2.
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

3.
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

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

TexturePacker: Click Publish sprite sheet

5.
Add texture and plist file to your project.

Add files to your cocs2d project

6.
Preload texture data

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

7.
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?