Making a drag and drop puzzle, want drag pieces to be located randomly and then drop to quiz. The random part is working using this code with r being placed in an array:
Code:
var r = Math.ceil(Math.random() * TotNumber);
while (choosenNumbers[r])
{
r = Math.ceil(Math.random() * TotNumber);
}
choosenNumbers[r] = true;
return r;
Any suggestions for a better random number generator welcomed.
The problem I am having is the return location, I use SetPosition(GetXLocation, GetYLocation) to set to a random location. But if the object is dragged unsuccessfully and I have Return to original position if not dropper it will return, not to the random location but to it's original location.
I have tried the dropped triggers but there is not trigger for object dropped anywhere. The only triggers that I thought might work do not, the Object Dropped trigger is for correct drop only. This Object Dropped is again only for correct drop as above and Drop Refused is only if the object is dropped in the wrong location.
There is no action for Object Dragged, this would basically do an action once the user has finished dragging and just dropped the object anywhere on the page.