home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Fácil 2 / CDFACIL2.ISO / lazer / JEWELS / PUZZ_02.DXR / 00238.ls < prev    next >
Encoding:
Text File  |  1994-12-14  |  1.3 KB  |  34 lines

  1. on dragBlock direction, clickPt
  2.   global originPt
  3.   if clickPt = [] then
  4.     set origMouse to point(the mouseH, the mouseV)
  5.   else
  6.     set origMouse to clickPt
  7.   end if
  8.   set calcH to the left of sprite the clickOn + ((the right of sprite the clickOn - the left of sprite the clickOn) / 2)
  9.   set calcV to the top of sprite the clickOn + ((the bottom of sprite the clickOn - the top of sprite the clickOn) / 2)
  10.   set origMouse to point(calcH, calcV)
  11.   repeat while the mouseDown
  12.     updateCursor()
  13.     set diffMouse to point(the mouseH, the mouseV) - origMouse
  14.     if direction = 1 then
  15.       set the locH of sprite the clickOn to getAt(originPt, 1) + getAt(diffMouse, 1)
  16.       next repeat
  17.     end if
  18.     if direction = 2 then
  19.       set the locV of sprite the clickOn to getAt(originPt, 2) + getAt(diffMouse, 2)
  20.       next repeat
  21.     end if
  22.     if direction = 3 then
  23.       set the locH of sprite the clickOn to getAt(originPt, 1) + getAt(diffMouse, 1)
  24.       set the locV of sprite the clickOn to getAt(originPt, 2) + getAt(diffMouse, 1)
  25.       next repeat
  26.     end if
  27.     if direction = 4 then
  28.       set the locH of sprite the clickOn to getAt(originPt, 1) + getAt(diffMouse, 1)
  29.       set the locV of sprite the clickOn to getAt(originPt, 2) - getAt(diffMouse, 1)
  30.     end if
  31.   end repeat
  32.   updateCursor()
  33. end
  34.