Is it possible to make two objects trade places by clicking on them? I know we cn do it by giving each object coordinates to move to, but is there an easier way?
Attaching them to an invisible platform
-When object a is clicked:
—attach to square 2
-when object B is clicked:
—attach to square 1
@kelfjel Unfortunaly there is no singular code block to swap two objects, however by making use of a function and variables you would omit the need to write an event for each object combination. Below I added a mockup of a swap with animation (a little more complex), and a much simpler postion swap. The simple one you could essentially use as if it were a coBlock, though you might have already made something similar yourself.
If we have, say, 10 different objects, and I would like to be able to click on one, and then another, and have them swap positions, how would I go about that? I guess I would somehow have to assign “item1” to the first object I click on and “item2” on the second, but I am not sure how.
@kelfjel Glad I could help, for multiple items you can make a true/false switch when clicking an item, storing the item clicked if its a new input (after the switch is set to False), and using the swap function if its the second input (after the switch is set to True). I’ve used a group to intiate but you could also manually make a list if needed.