如何使用Corona SDK在四个方向上移动显示对象?我正在开发一种迷宫游戏,敌人必须在四个方向上随机拍摄电影。
示例我已经尝试过了:
function transtionBack()
transition.to(police, {time = 1000, x = police.x, y = 0, onComplete = transtionTo() })
end
function transtionTo()
transition.to(police, {time = 1000, x = police.x, y = 400, onComplete = transtionBack() })
end
transtionTo()
这似乎行不通;有人有更好的主意吗?
最佳答案
我想我发现了问题
function transtionBack()
transition.to(police, {time = 1000, x = police.x, y = 0, onComplete = transtionTo })
end
function transtionTo()
transition.to(police, {time = 1000, x = police.x, y = 400, onComplete = transtionBack })
end
transtionTo()