How do I decrease a variable when an object is removed
I'd like to keep a tally for an addition equation that I'm using.
It's very simple. There are two boxes.
"box" + "box" =
A number would be dragged into either box and I want the equal variable to add the total between the two boxes of the dragged number. But when the number is removed I would like it to go down by that number.
So if they drag a 1 and a 2 into the boxes the total would say 3, but if they remove the 1 then I want it to say 2, and if they remove both I'd like it to say 0.
I've made it so far to be able to add the differences, but can't figure out how to make it remove the number from the total when the number is removed from the box.