Sticking an image to the cursor

Chipp Walters chipp at chipp.com
Sun Oct 12 00:03:00 EDT 2008


And if you want to do it outside a mouseDown, then replace mouseDown
with mouseEnter...

local lCurrentPieceDragged

on mouseEnter
   if the short name of the target contains"puzzlePiece" then
      put the target into lCurrentPieceDragged
   end if
   if lCurrentPieceDragged  is not empty and the short name of the
target contains "finalPosition"
      put the cMyPuzzlePiece of the target into tMyPuzzleName
      if tMyPuzzleName = lCurrentPieceDragged then
         put empty into lCurrentPieceDragged
         fitPuzzlePiece lCurrentPieceDragged
      end if
   end if
end mouseEnter

on fitPuzzlePiece pTarget
   --> STORE THE 'FIT' LOC AS A CUSTOM PROP
   --> OF THE PUZZLE PIECE
   put the cFinalLoc of pTarget into tLoc
   set the loc of pTarget to tLoc
end fitPuzzlePiece

on mouseMove x,y
   if lCurrentPieceDragged is not empty then
      set the loc of lCurrentPieceDragged to x,y
   end if
end mouseMove

** NOTE THIS IS ALL FROM MEMORY AND HAS NOT BEEN TESTED
   BUT THE STRATEGY SHOULD BE SOLID



More information about the use-livecode mailing list