I'm trying to move an object randomly to different locations, so I came out with the following: transition.to generates the x,y randomly as well as the time, and on finish runs another function which checks if the object is still there and sends it to a different location.
but I'm getting an error:
Runtime error
main.lua:352: stack overflow
stack traceback:
main.lua:352: in function
'toAnotherPlace'
looks like corona doesn't really waits for transition complete, so it goes on infinite loop
code
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])
})