【发布时间】:2013-12-22 17:39:44
【问题描述】:
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 的新手,所以我想知道为什么我的矩形没有在我的屏幕上使用这个功能移动?当我在下面仅使用此代码时,它会移动但最终会停止。我希望它反复从一侧移动到另一侧:
local rect = display.newRect(100, 100, 100, 100)
transition.to(rect, {time=500, x=300, y=100, onComplete=moving2})
【问题讨论】:
-
您是否尝试调用其中一个函数?
-
这完全取决于你在什么环境中工作——显示、newRect、过渡等不是语言的标准部分。