Magnet-like repel

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Magnet-like repel

Post by calmrr3 » Wed Nov 20, 2013 4:39 pm

Hello,

Is it possible to create something like this: http://www.absorblearning.com/media/att ... 4y&att=348
whereby the cursor is the main magnet and any graphics on the card animate as though they are being repelled when the cursor goes near to them.

Thanks!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Magnet-like repel

Post by FourthWorld » Wed Nov 20, 2013 4:46 pm

Yep - to get started, see the mouseMove message and the rectangle and location properties in the Dictionary.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Magnet-like repel

Post by Simon » Thu Nov 21, 2013 3:07 am

Hi Callum,
I know who I'm going to get to make my next video, saw yours (from another post) and they are great! :D

Ok so I've just built a demo of that magnet thing and here is my take:

Code: Select all

      put the right of btn 1 into tRight
      put the left of btn 2 into tLeft
      if tRight + 20 >= tLeft then --there is the key
            set the left of btn 2 to tRight + 20 --thats the answer
      end if
Well there is a start.
I'd be happy to help you with the rest of the mouseMove if you'd like.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Re: Magnet-like repel

Post by calmrr3 » Thu Nov 21, 2013 11:04 pm

Hi, Thanks! much appreciated.

I'll start experimenting and see how I get on :)

Post Reply