by Killagram » Wed Nov 05, 2008 4:08 am
there are many ways to do this. The more specific you can be, the better an answer you will recieve.
One method is to say, on object, mousebuttonup, if(distance(x,y, box.x, box.y)<n(MoveTo(Event Actor, box.x, box.y etc. etc. etc.)} else (MoveToEtc) Which will put it outside the box if they drag it far enough away, and back in the box if they didn't move it far enough away. However, the way you stated it, you didn't specify if they even CAN move it away. This is also a simple method which doesn't include what happens if there's already something else inside the box.
As i said, many, many, many ways.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
-Brian W. Kernighan