A few drag and drop queries
Apr 25, 2022
1) Is it possible to prevent an item from being dragged again after it has been placed into the correct drop target? I tried to set the state of the drag item to disabled, but I can still drag the item.
2) Is it possible to detect whether a drop target has been "occupied" by a drag target or not? I want to have an interaction occur if the player removes a drag target from a drop target, but have no idea how to do it.
3) Is it possible to have an interaction occur whenever a drag target is dropped on anything outside of specific drop targets? I originally thought to use "When the user drops object on the target" and selecting everything but the valid drop targets, but I realized that it doesn't activate if I just drop it on "white space" that is not occupied by any objects.
8 Replies
Hello Edmond!
All of these are possible! You can build this using variables to determine when objects change. Here's more about variables.
If you have a .story file that you can share, I'm happy to take a look!
I know about variables, but maybe I'm not sure how you can be using them to achieve what I want.
Would it be possible to arrange a time and we do a share screen rather than me sending the .story file?
Hi, Edmond.
The community will be the best place to get help with design questions! If you share your .story file here, I'm sure our talented members will be able to offer suggestions for your scenario.
I wanted to share a few resources that might also give you some inspiration and steps to try:
I hope this helps!
Hi Maria.
I looked through the links and it doesn't solve the problems I have. I saw a few interesting workarounds that my client may or may not be satisfied with (client has not gotten back to me as of this reply), so I'll thank you for sharing that, but my initial problems remains.
I'm not sharing a storyline file because I am working with potentially sensitive information and don't want to get into legal trouble. I was just planning on just starting a new project and getting guidance from there if people agreed to a screen share.
#1. Remember, this is a visual medium. Nothing has to do what you want it to, it only has to look like it is doing it. In this case, when the item is dropped, it disappears - therefore it can't be dragged again. The target changes to look like the item is dropped on it, so all is well. One way to do this is to create a state for the target that has the item dropped on it. When the item is dropped, change it to hidden, and change the state of the target to the "correct drop" state. This probably will mess up the regular submit and check process, so you may have to copy the Hidden state and name it "Drop Correct"
#2. Put a shape immediately behind the target. Make it filled (or it won't register actions), transparency set to 95% or greater (to make it invisible), and larger than the target (so it will register even if the learner drags it fast). Tie your interaction to the item being dragged over the shape. (Perform interaction when item is dragged over shape.) The action will also occur when the shape is dragged onto the target, so depending on what the action is, it might cause problems. If so, set it up so the action takes place only if the item has been dropped.
1. Create a variable named something like "ItemIsDropped". Make it T/F, with a default value of false
2. Change the trigger to "Perform action when item is dragged over shape, if ItemIsDropped = true"
3. Create a trigger "Adjust variable set ItemIsDropped to true when item is dropped on target"
4. Create a trigger "Adjust variable set ItemIsDropped to false when item is dropped outside of target"
#3. Create an invisible shape like in step two, but large enough to cover all the white space. Place it on the timeline below the drag items, drag targets, and the shape in step 2, if you are using them together. Place it so it is above everything the item can be dropped on outside the specific drop targets. Create a trigger "Perform interaction when item is dropped on shape."
In this case, you would use variables to tell SL if an object has been dropped on a specific target, which is something it wouldn't otherwise know. Use variables to tell the program what happened somewhere else, or that it can't normally know, like the following example.
Walt congratulations on becoming a Superhero!
Thanks, Phil. Looking at who's in that group, it's a true honor.
Sorry to hijack this post, I have been waiting to see when you get it, well deserved.