Subtract from variable with drag and drop

Jun 23, 2023

Hi all, looking for some guidance here. 

I'm creating an interaction where learners create a line plot by dragging and dropping Xs. I want to add one to a variable when the X dropped in one area, and subtract one from that variable when the X is dragged away or dropped somewhere else on the line plot 

I adapted some advice from a couple of different threads on here. Right now I have variables named STOP1 and STOP2 that I want to add/subtract from. I also have a variable named X whose value changes based on where I drop the X. I surrounded the drop target areas with a larger transparent rectangle named DRAG SUBTRACT.

-Add 1 to STOP1 when X dropped on Stop1

-Change value of X to 1 when X dropped on Stop1

-Subtract 1 from STOP1 when X dragged over DRAG SUBTRACT if X=1

-Change value of X to 0 when X dragged over DRAG SUBTRACT

It works perfectly on the first drop area, but I can't replicate for the second (and I want to create 7 in total, then add in additional Xs to be dropped). Can anyone spot what mistake I am making?

I'm not married to this manner of doing it if someone has a better suggestion. Thanks so much!

1 Reply
Walt Hamilton

Probably the largest problem is that you will need a unique variable for each stop. You can't get it to work trying to reuse "X".

That said, here is a sample of a way that is perhaps easier. I only created triggers for
Stop1 and Stop2. If you want, you can change the dropped location of the X by editing the dropped state of the Stops. I took out the add and subtract triggers. I think (I'm guessing here) that you had those to keep track of which items had a drop on them. Using states may be easier, but if you need those numbers for some sort of additional calculations, they should be pretty easy to add back in.

Any questions, ask.