Oh, pzuh is gameart2d…
Yes, that is correct.
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)
Note: PZUH is an artist.
OOPs… saw your response. I’m a bit out of sync.
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)
frames = { { -- 1) SPR\_COIN\_00 x = 125, y = 146, width = 18, height = 30, sourceX = 6, sourceY = 0, sourceWidth = 32, sourceHeight = 32, }, { -- 2) SPR\_COIN\_01 x = 651, y = 123, width = 30, height = 30, sourceX = 0, sourceY = 0, sourceWidth = 32, sourceHeight = 32, }, { -- 3) SPR\_COIN\_02 x = 124, y = 225, width = 18, height = 30, sourceX = 6, sourceY = 0, sourceWidth = 32, sourceHeight = 32, }, { -- 4) SPR\_COIN\_03 x = 124, y = 266, width = 10, height = 30, sourceX = 10, sourceY = 0, sourceWidth = 32, sourceHeight = 32, },
Yes, but to do this for 110 sprites, it would have taken a while. And I have multiple characters.
I am going to use multiple sequences but the problem comes with creating the imageSheet. The frames are not all the same size and width, and there are 110 of them.
Their sizes are clumped into groups, 9 consecutive have one same size, 10 consecutive have one same size, etc.
I’m confused. Are you hand rolling the image sheets and the lua file or using a tool like texturepacker?
If you’re doing this manually…well this is why folks use tools. Doing this by hand is labor intensive and super error prone. Also, having to adjust the sheet/lua file later is super painful.
All this pain goes away w/ a tool.
If you don’t have or cannot afford texture packer, shoebox is a viable option but it will require more effort.
I am using TexturePacker. I could never imagine doing it by hand.
The problem I am having is that the frames are not all the same size. The massive 110 sprite sheet contains walking, dying, shooting, jumping, throwing, etc. animations. The problem is that the size of the walk frames is different from the size of the dying frames, or the shooting frames…
Here is the image so you can see what I am saying:
Notice some of the different frame sizes.
I still don’t get it.
You take discrete images, drop them on texture packer, export a sprite sheet and definition file. Done.
How is this not working?
Maybe you can zip up a small demo projects with the original art and your spritesheet/lua file and share it with me?
PM if you can. I’ll try to look later.
Currently still have not internet. I literally am walking over to a neighbor’s every once in a while w/ my old laptop to check emails.
So next response may not be till tomorrow unless you respond quickly.
Remember, if you do PM me include original assets in zip file.
Alright. Thank you for your help. You should be receiving a PM soon.
Tip: You still have to write a custom sequence definition pulling the appropriate frames from your image sheet.
-Ed