Requires Texture packer ( 3.0.0b3 )
You need to edit your export Template //Program Files/TexturePacker/bin/exporters/corona-imagesheet/ corona-imagesheet.lua
You can modify this file to your own needs here is an example how i use it with two functions. “getSheet” , “getFrame”
[lua]–
– created with TexturePacker (http://www.texturepacker.com)
– {{smartUpdateKey}}
local V = {}
local sheet =
{
frames = {
{% for sprite in sprites %}
{ x={{sprite.frameRect.x}}, y={{sprite.frameRect.y}}, width={{sprite.frameRect.width}}, height={{sprite.frameRect.height}} }, – {{sprite.trimmedName}}
{% endfor %}
},
sheetContentWidth = {{texture.size.width}},
sheetContentHeight = {{texture.size.height}}
}
local frameindex =
{
{% for sprite in sprites %}
[’{{sprite.trimmedName}}’]= {{ forloop.counter }},
{% endfor %}
}
local function getSheet() return sheet end
local function getFrame() return frameindex end
V.getSheet = getSheet
V.getFrame = getFrame
return V[/lua]
Example:
[lua]local sheetInfo = require(“myExportedImageSheet”) – lua file that Texture packer published
local myImageSheet = graphics.newImageSheet( “ImageSheet.png”, sheetInfo.getSheet() ) – ImageSheet.png is the image Texture packer published
local myImage1 = display.newImage( myImageSheet , sheetInfo.getFrame()[“image_name1”] )
local myImage2 = display.newImage( myImageSheet , sheetInfo.getFrame()[“image_name2”] ) [/lua]
cheers Darkmod
lol: After looking at this it really should be “getIndex” and “getFrames” then nice thing is you can modify the export to your needs.
[import]uid: 7177 topic_id: 23739 reply_id: 323739[/import]