local rect = display.newRect(100, 100, 100, 100)
local moving, moving2
function moving()
transition.to(rect, {time=500, x=300, y=100, onComplete=moving2})
end
function moving2()
transition.to(rect, {time=500, x=100, y=300, onComplete=moving})
end
大家好。我是Lua的新手,所以我想知道为什么我的矩形没有在这个函数的屏幕上移动?当我仅使用下面的代码时,它会移动,但在最后停止。我希望它从一侧重复移动到另一侧:功能与transition.to()不起作用
local rect = display.newRect(100, 100, 100, 100)
transition.to(rect, {time=500, x=300, y=100, onComplete=moving2})
您是否尝试调用其中一个函数? –
这完全取决于你在什么环境中工作---显示,newRect,转换等不是语言的标准部分。 –