transition reverse

 target = display.newRect(0,0,50,50) target.x , target.y = 160 , 100 target2 = display.newRect(0,0,50,50) target2.x , target2.y = 150, 160 target3 = display.newRect(0,0,50,50) target3.x , target3.y =140 , 220 local reverse = 0 local function move() timer.performWithDelay(3800,move,1) if reverse == 1 then transition.to(target2,{x =target2.x-150,time = 3800}) transition.to(target,{x =target.x+160,time = 3000}) transition.to(target3,{x =target3.x+140,time = 2600}) reverse = 0 elseif reverse == 0 then transition.to(target2,{x =target2.x+150,time = 3800}) transition.to(target,{x =target.x-160,time = 3000}) transition.to(target3,{x =target3.x-140,time = 2600}) reverse = 1 end end move()

Is there any function can replace the reverse ? Sometimes the object will stop when I remove one of the object.

You can try:

 local group = display.newGroup() target = display.newRect(0,0,50,50) target.x , target.y = 160 , 100 group:insert(target) target2 = display.newRect(0,0,50,50) target2.x , target2.y = 150, 160 group:insert(target2) target3 = display.newRect(0,0,50,50) target3.x , target3.y =140 , 220 group:insert(target3) local function moveReverse() transition.to( group, { time=3800, x=(that you need), y=(that you need), onComplete=move } ) end local function move() transition.to( group, { time=3800, x=(that you need), y=(that you need), onComplete=moveReverse } ) end timer.performWithDelay(3800,move,1)

You can try:

 local group = display.newGroup() target = display.newRect(0,0,50,50) target.x , target.y = 160 , 100 group:insert(target) target2 = display.newRect(0,0,50,50) target2.x , target2.y = 150, 160 group:insert(target2) target3 = display.newRect(0,0,50,50) target3.x , target3.y =140 , 220 group:insert(target3) local function moveReverse() transition.to( group, { time=3800, x=(that you need), y=(that you need), onComplete=move } ) end local function move() transition.to( group, { time=3800, x=(that you need), y=(that you need), onComplete=moveReverse } ) end timer.performWithDelay(3800,move,1)