Hi
How to make a simple loop… I want to transition a object from A to B and then from B to A in loop.
I made something like this
local moveboard = function()
local movedown = function()
transition.to(object, { 200, y = 200, onComplete = moveboard} )
end
transition.to(object, {200 , y =300, onComplete= movedown } )
end
moveboard()
It’s moving but it stops !!!
by the way if you have few object on a screen that should move I suppose to use transition or is different way for many objects ?
Thank you [import]uid: 13156 topic_id: 5947 reply_id: 305947[/import]
You had the right idea in the first place, but defining one function inside another like that messes up the scope. Just off the top of my head, does this work?
function moveboard()
transition.to(object, {200, y = 300, onComplete = movedown})
end
function movedown()
transition.to(object, {200, y = 200, onComplete = moveboard})
end
moveboard()
[import]uid: 12108 topic_id: 5947 reply_id: 20465[/import]
Thanks jhocking but unfortunately no … the same.
hmmm I don’t know why ? Any Idea ? This two functions are inside w function drawLevel… but I think is not a problem… [import]uid: 13156 topic_id: 5947 reply_id: 20485[/import]
Yeeeee THANK YOU dweezil and jhocking… my solution is ok too the problem was with local… if the function is global is ok.
You know why ?
[import]uid: 13156 topic_id: 5947 reply_id: 20571[/import]
Its to do with scope, the way you had it one function was inside another and as it was local then one couldn’t ‘see’ the other. [import]uid: 9371 topic_id: 5947 reply_id: 20574[/import]