# how to move object?

0 favourites
• 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
• how objects move the object from x to y with a smooth move

• You could use lerp.

Here is a link to a discussion on how to use it.

https://www.scirra.com/forum/viewtopic.php?t=64020&start=0#286732

• I really like rex' moveto plugin:

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• THere are tons of ways.

The most beautiful is using rex' moveto plugin as Rabenmutter suggested. But, if you are like me and don't want to use 3rd party plugins out of fear that they are compatiable down the road.

Then bullet behavior is pretty cool and does a fantastic job.

Open C2

Click New

Now scroll down list till you see move to mouse its past the 8 direction stuff and near the line of sight template.

Its great hey

• ``````// se the movement parameters
Global number xA = 10
Global number yA = 20
Global number xB = 100
Global number yB = 120
Global number speed = 100

// some variables used in runtime
Global number dist = 0
Global number t = 0

System: trigger once
-> System: set dist to distance(xA,yA,xB,yB)

System: t<1
-> System: set t to min(1, dt*speed/distance)
-> Sprite: set X to lerp(xA,xB,t)
-> Sprite: set Y to lerp(yA,yB,t)[/code:3hpqub3m]

With that you have a clean, precise and constant motion from A to B
note that lerp isn't some magic function.
lerp(a,b,t)  = a + (b-a) * t
no more, no less. You give it 3 values, it gives you one.``````
• 5 posts