I'm a robot

Getting started: TexturePacker and Corona SDK

TexturePacker and CoronaSDK 20 seconds to your optimized image sheet
twitter image ron gilbert @grumpygamer

Integrating the excellent TexturePacker into my build pipeline has saved me countless hours! Not sure how I lived without it.

Ron Gilbert / Double Fine Productions - creator of MonkeyIsland, The Cave, Broken Age and Thimbleweed Park

This overview shows you how to create your first image sheet and import it into your Corona SDK project.

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

1.
Open TexturePacker, select Corona SDK (image sheet) as framework.

TexturePacker: Select Corona SDK (image sheet) 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 Corona SDK project.

TexturePacker: Click Publish sprite sheet

5.

Load the image sheet information file created with TexturePacker into memory.

local sheetInfo = require("spritesheet")

6.

Load the created image file.

local myImageSheet = graphics.newImageSheet
    ( "spritesheet.png", sheetInfo:getSheet() )

7.
Create images

getFrameIndex allows you to access the sprites by their name.

display.newImage( myImageSheet , sheetInfo:getFrameIndex("spritename"))

8.
Create animations

Use getFrameIndex to retrieve the index of the first frame.

local sequenceData = {
    {
    name="walk",                                  -- name of the animation
    sheet=myImageSheet,                           -- the image sheet
    start=sheetInfo:getFrameIndex("capguy/0001"), -- first frame
    count=8,                                      -- number of frames
    time=1000,                                    -- speed
    loopCount=0                                   -- repeat
    }
}

-- create sprite, set animation, play
sprite = display.newSprite( myImageSheet, sequenceData )
sprite:setSequence("walk")
sprite:play()

Do you want to read more?

Head over to our Corona SDK tutorials section.

Do you have any feedback or questions?

I'm a robot