I have a curious doubt about texturepacks. Imagine I have 2 images and I am using TexturePacker to create an Atlas of them. So I will have something like that.
local sheetOptions =
{
frames = {
{
– brazil
x=0,
y=0,
width=246,
height=250,
sourceX = 1,
sourceY = 0,
sourceWidth = 250,
sourceHeight = 250
},
{
– canada
x=718,
y=0,
width=226,
height=210,
sourceX = 7,
sourceY = 23,
sourceWidth = 250,
sourceHeight = 250
},
},
sheetContentWidth = 995,
sheetContentHeight = 250
}
And then, I wil load image1 :
ship = display.newImageRect( mainGroup, objectSheet, 1, 40, 40 )
I must use index of texturepack to load the image. But what happens if I must add more images and the indexes get different? I will have to change all the code where it calls them? Or there are an easier way to do it?