home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / PegScramble.dxr / 00027.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  595 b   |  32 lines

  1. global pegData, grabbedPiece
  2.  
  3. on mouseDown
  4.   finalID = 0
  5.   finalDist = 30
  6.   repeat with wTest = 1 to count(pegData)
  7.     testDist = findDistance(the mouseLoc, pegData[wTest][1])
  8.     if testDist < finalDist then
  9.       finalDist = testDist
  10.       finalID = wTest
  11.     end if
  12.   end repeat
  13.   grabbedPiece = finalID
  14.   if grabbedPiece <> 0 then
  15.     playSound("pickup", 4)
  16.   end if
  17. end
  18.  
  19. on mouseUp
  20.   if grabbedPiece <> 0 then
  21.     grabbedPiece = 0
  22.     playSound("drop_anywhere", 5)
  23.   end if
  24. end
  25.  
  26. on mouseLeave
  27.   if grabbedPiece <> 0 then
  28.     grabbedPiece = 0
  29.     playSound("drop_anywhere", 5)
  30.   end if
  31. end
  32.