DragDrop Behavior - DragStart work with other conditions?

0 favourites
  • 4 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I'm trying out the DragDrop behavior on a sprite and I'm using the DragDrop drag start trigger. I have another condition there in the drag start event block, which is a check on a global boolean variable named "playerInputIsOn", it looks for it to be true. I'm using "playerInputIsOn" to disable player input at different times in the game.

    So when I set "playerInputIsOn" to false, the drag start event block still executes its actions. Is this how the DragDrop behavior is supposed to work or am I doing something incorrectly?

    Thanks for any help.

    Tagged:

  • If you simply add "playerInputIsOn=true" condition to "On drag start" event, it won't stop the dragging if the input is false. The event will simply not run.

    You need to use "Drop" action:

    Sprite On drag start
    playerInputIsOn=false : Sprite Drop
    
  • Hey thanks a bunch - that worked!

    I even phrased my problem incorrectly and you wisely gave the right answer.

    I incorrectly said the event block still executes when playerInput is false. Well, no, the event block doesn't get executed, like you said.

    What I was really wanting to find out was why the drag start still happens and the sprite still gets dragged. And that dragging was what I was trying to prevent. I'm realizing that the DragDrop behavior has its own code it's executing and to alter what it's doing I gotta use the Drop action.

    Thanks again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another (possibly better) option is to enable/disable Drag and Drop behavior when playerInputIsOn variable is changed.

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