how to use spritesheet sequences with multi resolution ?

i,

i’m trying to set my project for multi-resolution.

i’ve read and understood that display.imageRect(“mycar.png”) will automatically pickup the right file 

if I have defined my config.lua correctly (fingers crossed I have…) and each picture has multiple resolutions as

mycar.png

mycar@2x.png

mycar@3x.png

Now i’m using spritesheet out of TexturePacker where i have

mycar01.png

mycar01@2x.png

mycar02.png

mycar02@2x.png

mycarcrash01.png

mycarcrash01@2x.png

mycarcrash02.png

mycarcrash02@2x.png

mybike01.png

mybike01@2x.png

mybike02.png

mybike02@2x.png

etc…

so far (with only mycar01.png, mycarcrash01.png, mycarcrash02.png, … i.e. one resolution only)

it’s all fine.

e.g. 

sheetInfomycar = require("mycarsheet") imageSheetmycar = graphics.newImageSheet("assets/car-scene1.png", sheetInfomycar:getSheet() ) local sequenceData = {      {name="mycardriving", frames={1,2}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mycarcrash", frames={3,4}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mybikedriving", frames={5,6}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mybikecrash", frames={7,8}, time=1000,  loopCount = 0, loopDirection = "bounce"} }   mycar = display.newSprite( imageSheetmycar,sequenceData)   sceneGroup:insert(mycar);   mycar.x = display.contentCenterX ; mycar.y = display.contentCenterY   mycar:setSequence("mycardriving")   mycar:play()

that works a treat, all good !

but now … the frame index for the ‘mycardriving’ sequence is different depending on the resolution 

(and dont necessarily follow each other)

… so do I have to say 

local sequenceData = {      {name="mycardriving", frames={1,2}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mycardriving@2x", frames={11,12}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mycarcrash", frames={3,4}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mycarcrash@2x", frames={13,16}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mybikedriving", frames={5,6}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mybikedriving@2x", frames={14,15}, time=1000,  loopCount = 0, loopDirection = "bounce"},     {name="mybikecrash", frames={7,8}, time=1000,  loopCount = 0, loopDirection = "bounce"} {name="mybikecrash@2x", frames={9,10}, time=1000,  loopCount = 0, loopDirection = "bounce"} } and also for @3x, @4x etc.. ??

and when I code 

mycar:setSequence("mycardriving")

Corona will know to pickup  

mycar:setSequence("mycardriving@2x")

 depending on the resolution ?

  

 is this the correct ?

thanks@4x 

Well, that’s one way to go about it, but I’ve never encountered this issue. The sequences should be the same across the variants unless you’ve renamed the images within them.

Would you upload two of those lua files outputted by TexturePacker, a default and its 2x variant, so that we can see what’s wrong.

@edualc: I think you just need to click the “force identical layout” button at the bottom of the “scaling variants” modal. Then re-pack and all of your spritesheets should work without having to switch between the different sprite sheet Lua files. 

See screenshot below:

Hi @edualc,

Maybe tutorial Dynamic Content Scaling for Corona SDK will be useful  for you.

Have a nice day:)

ldurniat

thank you @idurniat,

that helped a lot indeed. I just wish there were an example for multisheets and sprite sequences.

But it’s all good now and mycar now looks sooo sharp on my big tablet !

TexturePacker is really a very good product well worth the licence fee !

thanks@4x

Well, that’s one way to go about it, but I’ve never encountered this issue. The sequences should be the same across the variants unless you’ve renamed the images within them.

Would you upload two of those lua files outputted by TexturePacker, a default and its 2x variant, so that we can see what’s wrong.

@edualc: I think you just need to click the “force identical layout” button at the bottom of the “scaling variants” modal. Then re-pack and all of your spritesheets should work without having to switch between the different sprite sheet Lua files. 

See screenshot below:

Hi @edualc,

Maybe tutorial Dynamic Content Scaling for Corona SDK will be useful  for you.

Have a nice day:)

ldurniat

thank you @idurniat,

that helped a lot indeed. I just wish there were an example for multisheets and sprite sequences.

But it’s all good now and mycar now looks sooo sharp on my big tablet !

TexturePacker is really a very good product well worth the licence fee !

thanks@4x