Forum Discussion
restore dragged object position if dragged into incorrect place.
here's the scenario:
a slide with four text boxes (a, b, c and d) and four rectangles(1, 2, 3 and 4).
each text box can be dragged into any of the four rectangles but only one would be considered as correct, so, lets supose that the text box "a" have to be dragged into rectangle 1 in order to be considered as correct, so:
if the user drags the text box "a" into the rectangle 1, then this will happen:
the text box will turn green, the state of the text box will change to disabled so the user can't move it again and a layer with a positive msg (to reinforce the learning proccess) that can be hidden clicking on an oval in order to continue will be showed.
but if the user drags the text box "a" into rectangles 2, 3 or 4 then this will happen:
the text box will turn red, the state of the text box will change to drop incorrect and a layer with a tip message (to help the user to drag into the correct position) that can be hidden clicking on an oval in order to continue will be showed.
here's my question: how do i make that the text box "a" returns to it's original position after the user dops it into an incorrect rectangle?
i've tried two things:
changed the state of the text box to "drop incorrect" but it only allows me to change the format of the text box (change it into red as said before) but the text box remains where it was droped and i can't find a place where i can tell storyline to restore the original object position if the state is drop incorrect.
used the option "dragged over" instead of "dropped on" and "technically" does the job (returns the text box into it's original position) but i don't feel like really happy with this option basically because drag over and drop on are diferent types of interaction.
here you can find an example of what i've told you in this long post: http://ares.unimet.edu.ve/acad/Convenciones/story.html
and here is the .story file http://ares.unimet.edu.ve/acad/Convenciones/convenciones.story if you want to check it.
my best regards to you all. (excuse my english since it's not my mother tounge)
- MariaCSStaff
Hi, Mukesh.
Thank you for sharing your .story file!
There are a few ways to accomplish what you're looking for, but one suggestion would be to use Motion Paths. Take a look at this discussion for additional information and a short tutorial.
Here are the triggers I would add to your Wrong layer:
The Line Motion Path 1 has the same starting and ending points:
I am attaching the edited .story file with the proposed changes.
Let me know if you have additional questions!
- MukeshGuptaCommunity Member
Hi Maria, Thank you so much for your effort in solving the problem. It really worked.
- BrettConlonCommunity Member
Hi, I also came here looking for a snap-back solution but the above suggestions don't address moving the incorrect answers back to their original position once the Submit button is pressed.
I then found the following YouTube video, by David Anderson, that is the PERFECT fit. David suggests creating a motion path animation for the drag objects and using a trigger that sets a Motion Path but the path is zero pixels long (ie. the start and end position is the original position - where you want it to snap back to):
https://www.youtube.com/watch?v=PdhSjUOva4Y
In my project I have 8 Drag labels that need to be dropped at the top of 8 descriptions and I'm giving them unlimited attempts at it.
The only changes I made to my project was to change the trigger for the motion path to occur when the learner presses the Submit button (not based on the timeline, like David suggests). I also didn't add a "Drop Incorrect" state so that the "incorrect" objects look "fresh" when they are returned to their starting point after the Submit button is pressed.
Hi, Brett!
Thanks so much for sharing your findings in this thread! So glad to hear my colleague David's video was able to provide you with a perfect workaround using Motion Paths and appropriate triggers. Great news!
I'm sure others will appreciate this as they come across this thread.
If any other discoveries come up, feel free to reach out in the E-Learning Heroes Community!
Have a great weekend! ✨