Hold down mouse button to enable drag&drop

Get help using Construct 2

Post » Tue Sep 04, 2012 1:08 pm

I'd like to know if there is any way of enabling drag&drop of an object (i.e. a sprite) only after holding down a mouse button for a certain amount of time.

What I want to accomplish is:
1) Enable the sprite's drag&drop behavior after holding down left button for 2 seconds.
2) Move the sprite and drop it at the desired position.
3) When dropped, disable drag&drop (this is easy)

Thanks!
B
19
S
8
G
4
Posts: 11
Reputation: 4,509

Post » Tue Sep 04, 2012 2:17 pm

Here's one way to do it:

DragDelay.capx (r101)

You could probably use the Drag&Drop behaviour if you want, but I prefer just using events. Hope it helps!
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Sep 05, 2012 12:34 pm

[QUOTE=Nimtrix] Here's one way to do it:

DragDelay.capx (r101)

You could probably use the Drag&Drop behaviour if you want, but I prefer just using events. Hope it helps![/QUOTE]

Thank you Nimtrix, that was helpful. I was trying something different, though. I'd like to enable the drag&drop behavior when the "clicking timer" finishes, but not having to click again to start dragging the object.

Your solution works without using drag&drop, but if you move the mouse too quickly it grabs a different Sprite... any ideas?
B
19
S
8
G
4
Posts: 11
Reputation: 4,509

Post » Fri Apr 18, 2014 6:03 pm

Hi, I'm also looking for the same solution but can't accomplish without a second click which is not what I want. Did you manage to solve this?
B
5
Posts: 28
Reputation: 283


Return to How do I....?

Who is online

Users browsing this forum: currypuff, makotto, randomly, Walessio and 27 guests