Drag and drop and resetting variables

Apr 30, 2014

Hi Guys,

Here's an interesting one for you.

I have created a drag and drop interaction that allows the user to stack boxes on to a shelf. When the user drops the box onto a shelf, it changes a variable to true or false. The user must get all the boxes in the right places to get all the variables to true and progress.

Now I have the logic setup correctly and I have also set it up so that if they move a box it changes the variable accordingly, even down to if they decide to change their answers, but there is one major flaw in my plan! if you drag a box off the shelf, the variable does not change, so you can remove a true answer and pass with 3 boxes!

Is there any function or method of resetting a variable, if the user drags a object off it's target?

Any help as always appreciated and I have included the project file

5 Replies
Keith Dykes

Actually, the problem lies here:

Lets say you have Box A, B, C and D and shelf 1 - 4.

A and B can go in either shelves 1 and 4

C and D can either go in 2 and 3

A - 1 True

C - 2 True

D - 3 True

B - 4 True

How can you tell storyline that shelf 1 has box A on it, but the user has dragged box B from shelf 4 so only reset shelf 4 to false? its already hurting my head lol

Keith Dykes

Hi Rebecca,

Thanks for that, it did give me an idea of how to take this forward, I am applying some final tweaks now. I am just about to pass it on to my colleague to see if she can break it.

I ended up adding a clear box, which covers the entire slide, but underneath the various images needed for the interaction. I then added another 4 variables which set to true if a box is added to any shelf and then returns to false if it is dragged over the clear box.

The only problem I have found so far, is that when a box snaps back to its starting point, it does not clear the variable (as it has not been 'Dragged over' or 'Dropped on') and this can give the user the incorrect messages. So far, I have not been able to fix this and I loath to reset the state of the interaction to the start, every time a user gets it wrong.

I have included the new version of it for you guys to have a look at, If you break it, let me know!

This discussion is closed. You can start a new discussion or contact Articulate Support.