Page 1 of 1
Finding name of an image I just dropped another image on
Posted: Sun Aug 24, 2014 5:33 pm
by Livecoder
Hi everyone. I am developing a game in which you can drag and drop different images around the screen using
I have image "Red" and i want to know the name of the image i just dropped it on without having to have a whole heap of code manually checking each possibility. Any ideas on how I could go about this?
Thanks
Livecoder
Re: Finding name of an image I just dropped another image on
Posted: Sun Aug 24, 2014 7:28 pm
by Simon
Hi Livecoder,
That was FUN!
Without a ton of code use a repeat loop and check if the loc of img "RED" (more robust if you say the loc of me) "is within" the rect of one of the other images.
OK so that is very cryptic, but see if you can figure out what I'm talking about. I did it in 9 lines.
If you still have trouble just ask
Simon
Re: Finding name of an image I just dropped another image on
Posted: Sun Aug 24, 2014 9:10 pm
by sritcp
Hi Livecoder:
Put the following code in the card script:
Code: Select all
global gTheObjectUnder
on mouseEnter
put the name of the target into gTheObjectUnder
end mouse Enter
on mouseLeave
put empty into gTheObjectUnder
end mouseLeave
The global will contain the name of the underlying object (until the mouse leaves the object).
Regards,
Sri