I’m making a game that involves grabbing coins and moving them to a location. At this point, I have an array of quarter images and I need for the hand cursor to ONLY grab the top image when two of the images get overlapped.
Here’s the part of the code in question:
function gameStart():void
{
Mouse.hide();
openHand.x = mouseX - (openHand.width / 2);
openHand.y = mouseY - (openHand.height / 2);
handClosed.x = mouseX - (handClosed.width / 2);
handClosed.y = mouseY - (handClosed.height / 2);
counter = 0;
**do{
if (quarter[counter].hitTestObject(handClosed) && mouseDown==true) {
quarter[counter].x = mouseX - (quarter[counter].width / 2);
quarter[counter].y = mouseY - (quarter[counter].height / 2);
}
counter++;
} while (counter < 5);
** }