Jittery sprites fix or documentation

When you have x1, x2 and x4 sprite sheets, corona load the correct image and then extrapolate the frame locations information from the x1.
The problem is: I am not finding a way to make this work correctly, no matter what I do in texture packer, x2 and x4 get jittery (with each frame slighly off-center).

Can I have documentation of how the size data scaling actually work, or another feature to help with that? (maybe support to have the sheet information for each size… like sheetdata[“default”] sheetdata["@2"], sheetdata[“ipadHD”]

[import]uid: 142895 topic_id: 27405 reply_id: 327405[/import]

I don’t bother with all the automatic stuff for @1x @2x and @4x when using my texture packer sheets. I wrote a little layer based on crawlspacelib that detects the current scale:

[lua]scale, suffix = display.contentScaleX, “”
if scale <= .25 then
suffix = “@4x
tpsuffix = “@2x
tpscale = .25
elseif scale <=.5 then
suffix = “@2x
tpsuffix = “”
tpscale = .5
else
suffix = “”
tpsuffix = “”
tpscale = 1
end[/lua]

and then use this to load a different sprite sheet and sprite sheet data file, since Texture Packer will automatically export the 2x and 1x versions. I’m just supporting 4x and 2x for right now, and TP only exports 2x and 1x, so thats why I have the [lua]tpsuffix[/lua] variable which does that conversion until TP exports 4,2,1.

so your idea about sheetdata[“default”] sheetdata["@2"], sheetdata[“ipadHD”] is right, you just need to implement it yourself. [import]uid: 122310 topic_id: 27405 reply_id: 111341[/import]

@stan8, you are correct, Corona loads images (whether they are sprite sheets or normal images) using the suffixes, but only pays attention to the 1x frame data.

This is because when the “require” method only loads the Lua file you specify (no suffixes are added).

The problem is that TexturePacker may not be precisely scaling the images. Corona expects the 2x and 4x images to be precise scales of the 1x image.

A partial solution is similar to what @aisaksen proposes. It’s a hybrid of manual and automatic.

You manually figure out which frame data to ‘require’ (i.e. you specify “data”, “data2x”, etc). And then let Corona automatically load the correct image, based on the content scaling suffixes (i.e. you just pass in ‘sheet.png’ and Corona will load using the suffixes you specify in config.lua).

I’ve contacted Andreas (author of TexturePacker) to see what can be done to improve this. [import]uid: 26 topic_id: 27405 reply_id: 111413[/import]

We fought this for a while and the heart of the issue is Zwoptex and TexturePacker only out put whole numbers in their lua files. That being the case there seems to be very little chance the 1x would ever exactly line up with the 4x sheet. The only way to get rid of the shaky sprites is to pass in the the correct spritesheet data file with suffix. [import]uid: 9840 topic_id: 27405 reply_id: 111460[/import]