Can I use transition.to to move one object to another moving object?
This is not working because the x,y position of the moving object has changed after the transition.to tween ends.
[lua]transition.to( object, { time=620, x=movingObject.x ,y=movingObject.y, transition=easing.inOutQuad} )[/lua] [import]uid: 10820 topic_id: 5390 reply_id: 305390[/import]
local circle = display.newCircle( display.contentWidth-20, display.contentHeight-20, 20 )
circle:setFillColor(0,255,50)
local btn= display.newCircle( 60, display.contentHeight-60, 40 )
btn:setFillColor(200,0,0)
local touched = false
local function f_btn (event)
if event.phase == “began” then
transition.to( circle, { time=620, x=square.x ,y=square.y, transition=easing.inOutQuad} )
touched = true
end
end
function enterFrameFunction ()
square.x =square.x -10
if square.x < 0 then
square.x = display.contentWidth
end
if touched then
circle.x = circle.x -10
if circle.x < 0 then
circle.x = display.contentWidth
end
end
end