If all you want to do is use a transition to move an object from one corner to another and back again, in an infinite loop, I really don’t know why you even need IF statements. I mean, it’s not like you don’t know when the object reaches 0,0… so you don’t need to check for that. You know it reaches 0,0 when the transition finishes…
-- transition help local circle = display.newCircle( 0,0,50 ) local trans local toBR, toTL toBR = function( obj, time ) trans = transition.to( obj, { time=time, x=display.contentWidth, y=display.contentHeight, onComplete=function() toTL( obj, time ) end } ) end toTL = function( obj, time ) trans = transition.to( obj, { time=time, x=0, y=0, onComplete=function() toBR( obj, time ) end } ) end toBR( circle, 2000 ) -- when you want to stop the infinite transitions, simply call this: -- transition.cancel( trans ) -- trans = nil -- but make sure you nil it afterwards
