how to move object to a given position, without using transition?

Hi,

I need to move an object from the top of the screen to a position at the bottom. I am using setLinearVelocity to move the object.

How could I set co-ordinates for the object to move to? I need the speed to be dynamically updated so I can’t use the transition.to command.

Thanks [import]uid: 8699 topic_id: 8749 reply_id: 308749[/import]

have you tried using Runtime?

[lua]-- assume you have the object created here

– put the runtime here

local gameLoop = function ()
local speed = 1

object.y = object.y + speed

– if you want the object to stop at the bottom then add this
if object.y == 300 then – example
object.y = 300
end
end

Runtime:addEventListener(“enterFrame”, gameLoop) [import]uid: 12455 topic_id: 8749 reply_id: 31898[/import]

sorry I might not have been clear. I need it to move smoothly to the destination x,y. Like a car driving to the point.

The starting x,y are 135,0

I need it to end up at 130,480

But It needs to move smoothly to the position. The same effect transition.to would have, but the movement speed can increase or decrease dynamically, which is why I can’t use transition.to
[import]uid: 8699 topic_id: 8749 reply_id: 31901[/import]

You may implement your own transition function by doing the geometry stuff in enterFrame.
– Advanced UI + Graph for Corona® | Website | Forum (https) | See: [import]uid: 11385 topic_id: 8749 reply_id: 32062[/import]

thanks for the replies! I will need to touch up on my geometry and give it a try! I have a temp work around by having a line that it follows to the bottom, but it’s not ideal! [import]uid: 8699 topic_id: 8749 reply_id: 32643[/import]

@gazjm Hello! Can you show an example how you have an object following a line?

Thanks,

Willy J.
[import]uid: 66859 topic_id: 8749 reply_id: 40074[/import]