Smooth drag and drop

Get help using Construct 2

Post » Fri Mar 22, 2013 6:23 am

Hi!

How do I ensure a smooth drag and drop when I drag the elements across the stage in Construct 2? Thanks.
B
9
Posts: 44
Reputation: 570

Post » Fri Mar 22, 2013 8:23 am

You mean other than using the drag-and-drop behaviour?

You'd have to manually create the behaviour then, but instead of updating the object's position to mouse.x,mouse.y every tick (or as the mouse button is held down, specifically), use lerp to get a smooth movement: lerp(self.x,mouse.x,0.5);lerp(self.y,mouse.y,0.5).

The object will appear to lag behind the mouse, but adjusting the lerp interpolation to whatever is suitable will help minimise that while still smoothing out the movement.

Example capx.GeometriX2013-03-22 08:25:09
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Fri Mar 22, 2013 8:50 am

Hi!

I can't open the .capx file that you sent as my Construct 2 is version 120.2.

B
9
Posts: 44
Reputation: 570

Post » Fri Mar 22, 2013 9:25 am

You should update then :)
B
56
S
15
G
10
Posts: 910
Reputation: 11,972


Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 19 guests