1 object in the box

Hello,

I have one box and five objects. The goal I’m trying to achieve is that there can only be 1 object in the box at the same time.
So for example: If the spider is in the box and with the mouse I move the hand to the box. The moment the hand is also inside the box and I release my mouse, the spider goes to it’s original position (outside the box) and the hand stays in the box.

How can I programm that? I tried a lot of things put it doesn’t work. Thank you!

(I tried to upload a picture but it didn’t work).

Try giving a state variable to the objects, like “original”, “picked”, and “on box”.
When you move the hand, the state becomes “picked” and when you move it to the box and release it, the spider should become “original” and the hand should become “on box”.
Program the positions so that the sprites are visually in their original position or inside the box.
I guess that should work.