Hold down mouse button to enable drag&drop

0 favourites
  • 4 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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!

    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?

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)