Hello. I have a problem with this code. I want do a continuous movement but I can´t get it.
This is the code. Thank you.
function mov2 (self, position1, position2)
local pos1 = position1
local pos2 = position2
local nom = self
transition.to (nom, {time =2000, x= pos2, onComplete = mov1(nom, pos1, pos2) })
end
function mov1 (self, position1, position2)
local pos1 = position1
local pos2 = position2
local nom = self
transition.to (nom, {time =2000, x= pos1 , onComplete = mov2(nom, pos1, pos2)})
end
rec1 = display.newRect (0,0,50,50)
rec2 = display.newRect (0,200,50,50)
mov1 (rec1, 300, 10)
mov1 (rec2, 300, 50)