I am trying to adjust the Spritesheet exported JSON file so I can import the sprites with their position at their registration point.
In Flash I just add the offset which is frame.offsetInSource
to the position but that doesn't works... This is how I export it now:
function frameExport(frame)
{
var s;
if (hitFrame)
s = "\n,{\n";
else
s = "\n{\n";
s += AddKeyRect("frame", frame.frame);
s+= ",\n";
var spriteSourceSize = new Object();
spriteSourceSize.x = frame.offsetInSource.x;
spriteSourceSize.y = frame.offsetInSource.y;
spriteSourceSize.w = frame.sourceSize.w;
spriteSourceSize.h = frame.sourceSize.h;
s += AddKeyRect("offset", spriteSourceSize);
s += "}";
hitFrame = true;
return s;
}
How can I export this the good way, so their relative position is also exported as an offset variable? And are there also other variables you can use for this? I know you can use these variables:
frame.frame.x
frame.frame.y
frame.frame.w
frame.frame.h
frame.offsetInSource.x
frame.offsetInSource.y
frame.sourceSize.w
frame.sourceSize.h
Thanks in advance!