Zwoptex still uses the old sprite method and also uses the deprecated module function. This format updates the program’s output as well as provides support for dynamic resolution. The new format uses the complex example found in http://www.coronalabs.com/blog/2012/03/06/image-sheets-image-groups-and-sprites/
coronasdk.coordinatesformat.txt
Put this in the file: coronasdk.coordinatesformat.txt inside Zwoptex application contents: Contents/Resources folder
local M = {}
local getSheetOptions = function()
local options = {
frames = {
{% for sprite in spritesAndAliases %}
{
x = {{ sprite.textureRectX }},
y = {{ sprite.textureRectY }},
width = {{ sprite.textureRectWidth }},
height = {{ sprite.textureRectHeight }}
},
{% /for %}
},
sheetContentWidth = {{ metadata.sizeWidth }},
sheetContentHeight = {{ metadata.sizeHeight }}
}
return options
end
M.getSheetOptions = getSheetOptions
return M
Zwoptex Settings
Dynamic resolution requires each resolution of the sprite outputted by Zwoptex to have the exact same layout (e.g. if frame 1 is on the top left of the sprite png in the x1 sprite image, is should still be in the top left for @2x, and @4x). Use these settings to make your output images consistent:
-
_ Make sure all images are not trimmed _
-
Algorithm: Basic
-
Sort On: Name
-
Sort Order: Ascending
-
Sprite Spacing: 0px
Usage:
[lua]local options = require(“mysprite”).getSheetOptions()
local imageSheet = graphics.newImageSheet( “mysprite.png”, options )[/lua] [import]uid: 144908 topic_id: 28422 reply_id: 328422[/import]