Basically what he’s saying is use the onComplete parameter to call a function and set the same transition in that function. [import]uid: 12108 topic_id: 6537 reply_id: 22688[/import]
thanks a lot but for some reason the cloud doesn’t even move now, it just stays on one spot… any help? [import]uid: 10827 topic_id: 6537 reply_id: 22753[/import]
Off the top of my head, I’m guessing you typed onComplete=moveCloudComplete() instead of onComplete=moveCloudComplete
Putting in the parentheses causes the function to run immediately instead of waiting for the transition to finish. [import]uid: 12108 topic_id: 6537 reply_id: 22758[/import]
I don’t think it’s necessary to do it as two functions that call each other. Try:
local cloud = display.newImage("cloud.png")
local function moveCloud()
cloud.x = 390
cloud.y = 70
transition.to(cloud, {time=6000, x=-100, y=70, onComplete=moveCloud})
end
ADDITION: oh wait duh you need to actually call the function. Code in a function doesn’t run automatically, it waits until you tell it to. So at the bottom of the code write: