Easy object toward cursor

Get help using Construct 2

Post » Sat Feb 02, 2013 3:58 am

I have an object that is correctly moving toward the mouse cursor when the user holds the button down. I am doing it by simulating the 8-button control. When the object reaches the mouse cursor it passes it a little and then bounces back and takes some time to settle. How do I ease the object so that it lands on the cursor without passing it up?
B
15
S
5
Posts: 28
Reputation: 1,533

Post » Sat Feb 02, 2013 4:33 am

You can use Lerp to achieve this.

Check out this example.

Adjust the "MovementSpeed" variable to adjust how fast the object is moving while following.

Demo
http://dl.dropbox.com/u/403350/LerpTest/index.html

Capx
http://dl.dropbox.com/u/403350/LerpTest.capx
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Sat Feb 02, 2013 5:00 am

Thanks, @justifun. Would you mind uploading an r114 capx? I don't want to install r116 since I'm collaborating with others.
B
15
S
5
Posts: 28
Reputation: 1,533

Post » Sat Feb 02, 2013 5:11 am

Nevermind. I got it from the XML file. Works perfect. Awesome.
B
15
S
5
Posts: 28
Reputation: 1,533


Return to How do I....?

Who is online

Users browsing this forum: jobel, Yahoo [Bot] and 21 guests