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