Intersect Example

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Intersect Example

Post by KennyR » Thu Mar 28, 2013 4:40 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Intersect Example

Post by jmburnod » Thu Mar 28, 2013 10:04 am

Hi Kenny,
I made one stack you can download here
http://forums.runrev.com/phpBB2/downloa ... hp?id=1623
Best regards
Jean-Marc
https://alternatic.ch

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Intersect Example

Post by Youks » Thu Mar 28, 2013 12:51 pm

Thx for sharing Gentlemen! :D

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Intersect Example

Post by jmburnod » Thu Mar 28, 2013 1:02 pm

Hi Youks,
Thx for sharing Gentlemen!
Inch'Allah,we share what we received from this forum
Last edited by jmburnod on Thu Mar 28, 2013 4:56 pm, edited 1 time in total.
https://alternatic.ch

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Intersect Example

Post by Youks » Thu Mar 28, 2013 4:50 pm

Regards to all the Gurus & members of this very informative & helpful forum! :wink:

KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Re: Intersect Example

Post by KennyR » Thu Mar 28, 2013 10:22 pm

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 271 times

Post Reply