How do I move an object at a constant rate?

Is there a way to move objects along a path at a constant rate?

I have ten objects spawned at the same time in various x,y locations and I want them to move at a constant rate across the screen. Transition.to gives them all different speeds because of the _time _condition and gravity makes them increase their rate of speed.

Can someone point me in the right direction?

I was able to get it to work when I used performWithDelay and transition.to, but I couldn’t figure out how to use that method while putting all of the objects in the same table so I thought there might be an easier way to set an objects rate of speed along a path regardless of path distance.

A simple fix would be to use physics but set the gravity to (0, 0) and then call applyLinearImpulse to the objects.

If you’re using Physics, then you would use body:setLinearVelocity(xAmount, yAmount) on the body.  As long as this value unchanged the object will move with that velocity + gravity effects.  You can set an object to not be effected by gravity.  applyLinearImpluse just gives the object a shove and things like density and friction will slow it down over time.

If you are not using physics, you would use transition.to() to move things from point a to point b over time.

Rob

Here’s a tutorial I created to show you how to use transition.to() based on speed and not time:

http://masteringcoronasdk.com/free-corona-sdk-tutorial/transition-to-based-on-speed-not-time/

That may help you.

 Jay

A simple fix would be to use physics but set the gravity to (0, 0) and then call applyLinearImpulse to the objects.

If you’re using Physics, then you would use body:setLinearVelocity(xAmount, yAmount) on the body.  As long as this value unchanged the object will move with that velocity + gravity effects.  You can set an object to not be effected by gravity.  applyLinearImpluse just gives the object a shove and things like density and friction will slow it down over time.

If you are not using physics, you would use transition.to() to move things from point a to point b over time.

Rob

Here’s a tutorial I created to show you how to use transition.to() based on speed and not time:

http://masteringcoronasdk.com/free-corona-sdk-tutorial/transition-to-based-on-speed-not-time/

That may help you.

 Jay