Back and forth movement

 local steel = display.newImage( "levelimages/steel.png", 57 ,30 )  
 steel.x = \_W/2 + 20  
 steel.y = \_H/2 - 25  
 steel.rotation = 90  
 physics.addBody( steel,"static", {friction = 0, bounce = 0})   

I have this code steel, and I’m trying to find a efficient way to move it back and forth between two points.

Does anyone have a good idea of how to do this…?
[import]uid: 24708 topic_id: 18954 reply_id: 318954[/import]

transition.to is pretty good for this sort of things… [import]uid: 16142 topic_id: 18954 reply_id: 72989[/import]

I have been trying to use that, and it has proved to be very inefficent to manage. Can you provide a basic code? It would help alot, thanks! [import]uid: 24708 topic_id: 18954 reply_id: 73016[/import]

Here’s a rough example with a circle I threw together for you;

[lua]display.setStatusBar(display.HiddenStatusBar)

local object1 = display.newCircle( 160, 50, 20 )

local function tDown ()
transition.to(object1, {time=2000, y=430, onComplete=tUp})
end

function tUp ()
transition.to(object1, {time=2000, y=50, onComplete=tDown})
end

tDown()[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 18954 reply_id: 73022[/import]

The example is perfect Thanks Peach!, and DarkConsoles [import]uid: 24708 topic_id: 18954 reply_id: 73029[/import]