1

オブジェクトを別の場所にランダムに移動しようとしているので、次のようになりました: transition.to は x、y と時間をランダムに生成し、終了時にオブジェクトがまだそこにあるかどうかをチェックする別の関数を実行します。別の場所に送信します。

しかし、私はエラーが発生しています:

Runtime error
main.lua:352: stack overflow
stack traceback:
  main.lua:352: in function
 'toAnotherPlace'

コロナはトランジションの完了を実際には待たないように見えるので、無限ループに陥ります

コード

function toAnotherPlace(object) 
    if object ~= nil then
        transition.to( object,
            {
                time=math.random(1500,6000),
                alpha=1,
                x=(math.random(10, 310)),
                y=(math.random(10, 400)),
                onComplete=toAnotherPlace(object)
            })
    end
end

transition.to( bossess[boss],
    {
        time=math.random(1500,6000),
        alpha=1,
        x=(math.random(10, 310)),
        y=(math.random(10, 400)),
        onComplete=toAnotherPlace(bossess[boss])
    })
4

1 に答える 1