Page 1 of 1

Intersect Example

Posted: Thu Mar 28, 2013 4:40 am
by KennyR
Hi all...so many here have given me help on various topics so I thought I would share the love and give a small example of using intersect to detect when an object moves into the loc of another. Now I am no pro, but it will give some people like me a jumping off point for moving buttons, swapping positions of the buttons and detecting when they meet each other or other objects....Anyone who can add to this and show me a better way of doing this, it would be appreciated! But this is what I came up with....and I think it works pretty smooth... :lol:
Image Recognition.livecode.zip
(165.53 KiB) Downloaded 300 times

Re: Intersect Example

Posted: Thu Mar 28, 2013 10:04 am
by jmburnod
Hi Kenny,
I made one stack you can download here
http://forums.runrev.com/phpBB2/downloa ... hp?id=1623
Best regards
Jean-Marc

Re: Intersect Example

Posted: Thu Mar 28, 2013 12:51 pm
by Youks
Thx for sharing Gentlemen! :D

Re: Intersect Example

Posted: Thu Mar 28, 2013 1:02 pm
by jmburnod
Hi Youks,
Thx for sharing Gentlemen!
Inch'Allah,we share what we received from this forum

Re: Intersect Example

Posted: Thu Mar 28, 2013 4:50 pm
by Youks
Regards to all the Gurus & members of this very informative & helpful forum! :wink:

Re: Intersect Example

Posted: Thu Mar 28, 2013 10:22 pm
by KennyR
Thanks guys for checking out my example and commenting....I made some adjustments to the code after realizing that you could not position the buttons where you wanted and get them to switch places. Seems I am not yet skilled in the repeat command as of yet. So what I did was tell the handler to evaluate each button on touchStart and place its location in its own variable. Seems a little easier to keep track of each buttons location. When I was repeating with i=1 to the number of buttons on the card and placing each location on its each line, there was no reliable way to pull each line out for use and have it give the correct value I needed...(I am sure there is, but not in my tiny mind!) Anyhow, I commented Button "One" to show what my mindset was in creating this....Now it appears you can long press the button to move it, have it change the border and color of the rectangle and display the buttons name in real time as soon as the button makes contact. Plus you can now reposition the buttons and they will swap places correctly as well as go back to the original staring location if no button is touched. Please feel free to tell me what you think or add to this....thanks all!
Image Recognition.livecode.zip
(165.97 KiB) Downloaded 272 times