Getting started: TexturePacker and SpriteKit

This overview shows you how to create your first sprite sheet and include it into your SpriteKit project.

These easy steps will cost you less than 5 minutes - but greatly improves your development. Promised!

Open TexturePacker, select SpriteKit as framework.

TexturePacker: Select SpriteKit 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.

The header file is optional. It contains definitions for all sprite names helping you to detect missing sprites at compile time and avoid runtime errors.

Set the output path for your files

Click Publish sprite sheet to create the sprite sheet and store it in your project folder.

TexturePacker: Click Publish sprite sheet

Add atlasc bundle (and header file) to your project.
Create a folder reference, so the Xcode project is automatically updated in the future

Add atlasc bundle to your project

Create sprites

Use the sprite directly

texture = [SKTexture textureWithImageNamed:@"Background"];
sprite = [SKSpriteNode spriteNodeWithTexture:texture];

Or use the header file and check file names at compile time:

#import "sprites.h"
SKSpriteNode *sprite =
    [SKSpriteNode spriteNodeWithTexture:SPRITES_TEX_BACKGROUND];

Create animations

Use the sprite directly

SKAction *walk = [SKAction
                      animateWithTextures: SPRITES_ANIM_CAPGUY_WALK
                      timePerFrame:        0.033
[sprite runAction:walk];

Do you want to read more?

Head over to our SpriteKit tutorials section.

Do you have any feedback or questions?