Forum Discussion
Drag and Drop With Feedback Layers BUT NOT Correct or Incorrect
- 22 days ago
Although ThierryEMMANUEL has figured out a solution, I would still like to try a simpler version without using a tons of triggers.
I use the built‑in drag‑and‑drop function so that objects can return to the start area when a target is occupied. I also prefer using "state" for counting the TotalPlaced value and rely on two triggers to change the state.
What the built‑in model cannot change is that when another item is dropped on the same target, the original item still remains in the "placed" state even after returning to its initial position. Since this is the only issue in my solution, I thought—why not use the new AI assistant to solve the problem? Below is the prompt I gave the AI assistant, and it worked as expected. A single JavaScript snippet solved it.
Change the state of crit# to normal when they moves onto hotspot1 area. For example, change crit9 to normal when it moves onto hotspot1.
Here is my version3. As Nedim said, I also value discussions like this and gracful learn something from each other. Thank you!
I think I've finally got it!
Look at the third slide of the attached demo.
The principle: No built-in drag and drop. Each Crit gets the “Placed” state when it is dropped on one of the 7 drop zones OR onto of one of the other Crits (in case a drop zone is already occupied by another Crit). When you click the Finish button, it adds 1 to the ‘TotalPlaced’ variable for each “Placed” Crit. Done!
How to do : “They'll snap into place and/or return to their original spot if something else gets put on top of them.” ?
This is where Nedim's idea of using a motion path really helped me. Each Crit has a motion path of 0px (meaning it will return to its original spot). I trigger this motion path if the learner replaces the Crit on the starting area OR if the learner places another Crit on top of it (the new Crit stays and the previous Crit returns to its place). At the end of the 0px motion path, the Crit returns to its normal state. This way, only Crits with a “Placed” state are counted when you click Finish. It works...
What do you think ?
Related Content
- 4 months ago