Drag & Drop Behavior

0 favourites
  • 5 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • Hello Everyone,

    I need some guidance on the drag and drop behavior for an object. I can add the behavior to an object and drag it around with touch or the mouse but the problem is when the touch or mouse stops MOVING the objects drops and the mouse button or touch is still activated . I would like to drop the object when the BUTTON or TOUCH is released

    How would I go about doing that as the drag and drop behavior has no configurable options? Do I need to setup an event to handle this action?

  • Hey Vetie,

    Drag and Drop does have one function you can call...and that is "Set Enabled" or "Disabled"

    I have to say I havent encountered any problems with this at all yet

    But I do make certain that for each object or Family of objects you have I usually do this

    On start of Layout---> object or family="Set Drag + Drop Enabled" Enabled

    You Problem sounds Peculiar....The Drag and drop function works fine usually..

    Can you drop a CapX file here to sort it out....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the response. I have been messing around with my test and have figured out what the problem is but dont quite know how to fix it.

    I have an object (Block) and I was attaching the physics behavior and the Drag and Drop behavior. When I used my mouse and left clicked on the box, I could move it around the screen but when my mouse stopped moving (but still holding down the left mouse button) the block will drop to the ground.

    If I remove the physics behavior, drag and drop works as intended. What I am trying to do is create a connect 4 style game where I drag the piece to the correct slot and have it fall to its lowest location and thought physics would work for this.

    So basically I need the drag and drop behavior when I am moving the object but when I stop clicking (not moving) the mouse, physics will take over and drop the object due to gravity.

    Is it possible to setup an event to enable or disable physics on an object based on a mouse button condition or touch condition? i.e When left button released, enable physics.

    Thanks

  • You could make the object immoveable at "on drag start" and make it moveable again "on drop".

  • Thanks for the reply,

    That was the jolt I needed!

    My actor has 2 behaviors, Drag and Drop and Physics. I then created 2 events. When left mouse button down - set world gravity to 0 and When left mouse button released - set world gravity to 10.

    Works exactly like I wanted.

    Thanks

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