3

我正在尝试调整Spritesheet导出的 JSON 文件,以便可以导入精灵及其在注册点的位置。

在 Flash 中,我只是添加了该位置的偏移量,但这不起作用......这就是我现在导出它的方式:frame.offsetInSource

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;
 }

我怎样才能导出这个好方法,所以它们的相对位置也导出为偏移变量?还有其他变量可以用于此吗?我知道你可以使用这些变量:

frame.frame.x
frame.frame.y
frame.frame.w
frame.frame.h
frame.offsetInSource.x
frame.offsetInSource.y
frame.sourceSize.w
frame.sourceSize.h

提前致谢!

4

1 回答 1

3

我还尝试使用 Sprite Sheet Exporter 来导出每一帧的相对位置。但我发现,在元数据中,“frame.offsetInSource.x”的值始终为零。我想这就是我想要的,也是你想要的。

我尝试编辑 JSON.plugin.jsfl,取消注释跟踪。可悲的是它仍然为零。

直到现在,我还没有弄清楚为什么。

于 2012-12-01T16:23:20.523 回答