home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / shared.dxr / 01011_legos.ls < prev    next >
Encoding:
Text File  |  1995-11-21  |  3.4 KB  |  110 lines

  1. on cleanLegos
  2.   global theLegoList
  3.   set theLegoList to [:]
  4.   repeat with i = 1 to 48
  5.     puppetSprite(i, 0)
  6.   end repeat
  7. end
  8.  
  9. on mouseDown
  10.   global theLegoList
  11.   if not listp(theLegoList) then
  12.     exit
  13.   end if
  14.   set legoNum to count(theLegoList)
  15.   repeat with i = legoNum down to 1
  16.     set aSprite to getPropAt(theLegoList, i)
  17.     if rollOver(aSprite) then
  18.       set object to getProp(theLegoList, aSprite)
  19.       click(object)
  20.       exit repeat
  21.     end if
  22.   end repeat
  23. end
  24.  
  25. on new className, argList
  26.   set newObj to birth(script className, argList)
  27.   setProps(newObj, argList)
  28.   init(newObj)
  29.   return newObj
  30. end
  31.  
  32. on setProps me, argList
  33.   if not voidp(argList) then
  34.     set num to count(argList)
  35.     repeat with i = 1 to num
  36.       set prop to getPropAt(argList, i)
  37.       set value to getAt(argList, i)
  38.       if prop = #spriteChan then
  39.         set the spriteChan of me to value
  40.         next repeat
  41.       end if
  42.       if prop = #pressedCast then
  43.         set the pressedCast of me to value
  44.         next repeat
  45.       end if
  46.       if prop = #handler then
  47.         set the handler of me to value
  48.         next repeat
  49.       end if
  50.       if prop = #scrollSprite then
  51.         set the scrollSprite of me to value
  52.         next repeat
  53.       end if
  54.       if prop = #scrollField then
  55.         set the scrollField of me to value
  56.         next repeat
  57.       end if
  58.       if prop = #scrollFieldOut then
  59.         set the scrollFieldOut of me to value
  60.         next repeat
  61.       end if
  62.       if prop = #minButton then
  63.         set the minButton of me to value
  64.         next repeat
  65.       end if
  66.       if prop = #maxButton then
  67.         set the maxButton of me to value
  68.         next repeat
  69.       end if
  70.       if prop = #thumbButton then
  71.         set the thumbButton of me to value
  72.         next repeat
  73.       end if
  74.       if prop = #trackButton then
  75.         set the trackButton of me to value
  76.         next repeat
  77.       end if
  78.       if prop = #scrollLinks then
  79.         set the scrollLinks of me to value
  80.       end if
  81.     end repeat
  82.   end if
  83. end
  84.  
  85. on getLilCorral wanderinSprite, corralRect
  86.   set topOffset to the locV of sprite wanderinSprite - the top of sprite wanderinSprite
  87.   set bottomOffset to the bottom of sprite wanderinSprite - the locV of sprite wanderinSprite
  88.   set leftOffset to the locH of sprite wanderinSprite - the left of sprite wanderinSprite
  89.   set rightOffset to the right of sprite wanderinSprite - the locH of sprite wanderinSprite
  90.   set xMin to the left of corralRect + leftOffset
  91.   set xMax to the right of corralRect - rightOffset
  92.   set yMin to the top of corralRect + topOffset
  93.   set yMax to the bottom of corralRect - bottomOffset
  94.   return rect(xMin, yMin, xMax, yMax)
  95. end
  96.  
  97. on getBigCorral wanderinSprite, viewRect
  98.   set w to the width of sprite wanderinSprite
  99.   set h to the height of sprite wanderinSprite
  100.   set topOffset to the locV of sprite wanderinSprite - the top of sprite wanderinSprite
  101.   set bottomOffset to the bottom of sprite wanderinSprite - the locV of sprite wanderinSprite
  102.   set leftOffset to the locH of sprite wanderinSprite - the left of sprite wanderinSprite
  103.   set rightOffset to the right of sprite wanderinSprite - the locH of sprite wanderinSprite
  104.   set bigLeft to the right of viewRect - w + leftOffset
  105.   set bigTop to the bottom of viewRect - h + topOffset
  106.   set bigRight to the left of viewRect + w - rightOffset
  107.   set bigBottom to the top of viewRect + h - bottomOffset
  108.   return rect(bigLeft, bigTop, bigRight, bigBottom)
  109. end
  110.