Tip 2: All of the images for a particular animation sequence MUST be the same dimension.
i.e. If you have 5 images for a ‘run’ sequence, all 5 of the original discrete image MUST be of the same dimension.
If your assets come otherwise they won’t work without a lot of effort.
I have never run across a paid set of assets that don’t conform to these requirements.
Texture packer will take these ‘same sized source images’ and pack them in a sheet with just enough room to later pull them out, while fitting together very tightly.
Corona doesn’t support “removal of whitespace” that texture packer does so you will need to uncheck that option to ensure every frame is the same dimension.
The free art sprite you have downloaded won’t work as is in Corona without manually modifying it.
I gave you some bad advice, the sizes of the different sequences don’t have to be the same.
I’m not clear what trouble you’re having. I dropped them on texture packer, produced a sheet, then used the following code to show the sprites and swap animations w/o an issue:
I’ll PM you my code shortly.
-- ============================================================= -- Copyright Roaming Gamer, LLC. 2009-2015 -- ============================================================= -- main.lua -- ============================================================= --require "ssk2.loadSSK" --\_G.ssk.init( ) local centerX = display.contentCenterX local centerY = display.contentCenterY local function run( source, x, y ) local info = require( source .. ".demo") local sheet = graphics.newImageSheet( source .."/demo.png", info:getSheet() ) local sequenceData = { { name = "idle", start = info:getFrameIndex("Idle\_\_000"), count = 10, time = 1000, loopCount = 0, }, { name = "dead", start = info:getFrameIndex("Dead\_\_000"), count = 10, time = 1000, loopCount = 0, }, { name = "climb", start = info:getFrameIndex("Climb\_\_000"), count = 10, time = 1000, loopCount = 0, }, } local anim = display.newSprite( sheet, sequenceData ) anim.x = x anim.y = y anim:play() anim:scale(2,2) -- Swap sequences in a loop forever -- local curAnim = 1 local animNames = { "idle", "climb", "dead" } timer.performWithDelay( 2000, function() anim:pause() curAnim = curAnim + 1 if( curAnim \> #animNames ) then curAnim = 1 end anim:setSequence( animNames[curAnim] ) anim:play() end, -1 ) end run("orig", centerX, centerY)
I’m not sure if that’s only an issue with the resulting files created using TexturePacker but in general Corona does support the required offsetting for sprite frames. It’s defined by the sourceX, sourceY, sourceWidth and sourceHeight entries of a frame.
Here’s how it looks for a simple rotating coin where each source frame was 32x32 pixels (it’s created using my own image packing tool)