Forum Discussion
Drag and Drop Issue - How to disable drop targets
I am creating a fraction game where the player is dealt a card and can choose where to place the card. I disable the card once it is dropped because the player is not suppose to move the card after placing it. That all works fine. The issue is that the player can now drop another card on top of the first one and replace it, but I do not want that to happen. How can I disable the drop target once a card has been dropped on it. I've tried using triggers, but that hasn't worked either. I've attached my file. Any help would be appreciated.
- MatthewMcCabe-aCommunity Member
Hero status warranted, been wracking my brain over this and a transparent layer works beautifully, thank you 👍
- ShellyBriscoe-2Community Member
Transparent layer did not work for me. Had to set the draggable objects to Disabled once correctly dropped (so they could no longer be moved), and set the drop target to a Deleted state I created, so that an additional object could not be dropped on it.
- NaveenVerma-3edCommunity Member
I tried all the above solutions, but what works perfect for me is here :
Make new state for the Drop box and make this empty. then add individual triggers to the all correct drag boxes that.... State change of Drop box to "new state"(empty), when user drop correct drag box to the current drop box.
if you have 3 drop box and user can drop any of the 3 correct box, then add same 3 triggers on the current drag box.
Happy that its working fine for me :)
- NenadRadovic-c6Community Member
I've been struggling with this issue for days, until I finally found this comment, tried it out, and it worked for me! Thank you so much Naveen!
- WaltHamiltonSuper Hero
Naveen,
Can the learner drag the dropped item off the target? If so, does that cause problems?
There is a sample that may help solve that problem at the bottom of this discussion:
- LiGPlaymakersDeCommunity Member
So... The moving the target to an empty state after its been dropped on worked initially but after recent updates and making changes it no longer works.
Has anyone found a new work around? I am working on a file with 25 drop zones...
- CharlotteHaslerCommunity Member
I just had the same problem and because the solution with the states unfortunately no longer works, I tried BenMcKenna-ba88's idea. And it works!
More precisely: I created a motion path for each drop element that has a length of 0px and is completely outside the slide. This is triggered in my version as soon as the interaction is sent (but should work in the same way as soon as the correct element has been dropped). In addition, the dropped element is set to “deactivated” so that it can no longer be moved.
You can try the interaction here
And there is also the file:
(don't be surprised about the many triggers: I use them so that only one element can be in each position and to provide non-assigned elements with the appropriate status)