home *** CD-ROM | disk | FTP | other *** search
/ The Museum Of Anything Goes / MOAG.bin / pc / data / puzzle / shared.dxr / 00078.ls < prev    next >
Encoding:
Text File  |  1995-01-01  |  13.1 KB  |  454 lines

  1. on startMovie
  2.   global ITEM1, WHICHPICTURE, WHICHPATTERN
  3.   cursor(4)
  4.   MAKEMENUBAR()
  5.   set CURRENTMOVIE to the movie
  6.   set charc1 to char 3 of CURRENTMOVIE
  7.   set charc2 to char 4 of CURRENTMOVIE
  8.   set currentnum to charc1 & charc2
  9.   if charc1 = "0" then
  10.     set WHICHPICTURE to value(charc2)
  11.   else
  12.     set WHICHPICTURE to value(currentnum)
  13.   end if
  14.   set cnum to the number of chars in CURRENTMOVIE
  15.   set acode to char cnum of CURRENTMOVIE
  16.   if acode = "G" then
  17.     set WHICHPATTERN to 0
  18.   else
  19.     if acode = "B" then
  20.       set WHICHPATTERN to 1
  21.     else
  22.       if acode = "M" then
  23.         set WHICHPATTERN to 2
  24.       else
  25.         if acode = "W" then
  26.           set WHICHPATTERN to 3
  27.         end if
  28.       end if
  29.     end if
  30.   end if
  31.   go(2)
  32.   RESETITEMS()
  33.   REMIXDATA()
  34.   updateStage()
  35.   cursor(-1)
  36. end
  37.  
  38. on RESETITEMS
  39.   global ITEM1
  40.   if ITEM1 <> EMPTY then
  41.     set the ink of sprite (ITEM1 + 1) to 8
  42.     set ITEM1 to EMPTY
  43.   end if
  44.   repeat with x = 2 to 17
  45.     puppetSprite(x, 0)
  46.     puppetSprite(x, 1)
  47.     set the visible of sprite x to 1
  48.     set the ink of sprite x to 8
  49.   end repeat
  50.   puppetSprite(18, 1)
  51.   set ITEM1 to EMPTY
  52.   puppetSprite(24, 1)
  53.   puppetSprite(25, 1)
  54. end
  55.  
  56. on SCRAMBLELETTERS
  57.   global ITEM1, ITEM2
  58.   cursor(4)
  59.   set CURRENTMOVIE to the movie
  60.   set cnum to the number of chars in CURRENTMOVIE
  61.   set acode to char cnum of CURRENTMOVIE
  62.   if acode = "B" then
  63.     repeat with x = 2 to 17
  64.       set hpos to random(286)
  65.       set vpos to random(267)
  66.       set the locH of sprite x to hpos
  67.       set the locV of sprite x to vpos
  68.     end repeat
  69.     cursor(-1)
  70.     exit
  71.   end if
  72.   if acode = "W" then
  73.     repeat with x = 2 to 17
  74.       set hpos to random(286)
  75.       set vpos to random(267)
  76.       set awidth to the width of sprite x
  77.       set aheight to the height of sprite x
  78.       if (hpos + awidth) > 412 then
  79.         set overlap to hpos + awidth - 420
  80.         set hpos to hpos - overlap
  81.       end if
  82.       if (vpos + aheight) > 384 then
  83.         set overlap to vpos + aheight - 384
  84.         set vpos to vpos - overlap
  85.       end if
  86.       set the locH of sprite x to hpos
  87.       set the locV of sprite x to vpos
  88.     end repeat
  89.     cursor(-1)
  90.     exit
  91.   end if
  92.   set ITEM1 to EMPTY
  93.   set ITEM2 to EMPTY
  94.   set loclist to "51,48" & RETURN & "51,144" & RETURN & "51,240" & RETURN & "51,336" & RETURN & "154,48" & RETURN & "154,144" & RETURN & "154,240" & RETURN & "154,336" & RETURN & "257,48" & RETURN & "257,144" & RETURN & "257,240" & RETURN & "257,336" & RETURN & "360,48" & RETURN & "360,144" & RETURN & "360,240" & RETURN & "360,336"
  95.   set rnum to 16
  96.   repeat with x = 1 to 16
  97.     set goodnum to "False"
  98.     repeat while goodnum = "False"
  99.       set anum to random(rnum)
  100.       set sdata to line anum of loclist
  101.       if (anum <> x) and (sdata <> "Used") then
  102.         set goodnum to "True"
  103.         if anum = rnum then
  104.           set rnum to rnum - 1
  105.         end if
  106.         next repeat
  107.       end if
  108.       if (anum = x) and (x = 16) and (sdata <> "Used") then
  109.         set goodnum to "True"
  110.         if anum = rnum then
  111.           set rnum to rnum - 1
  112.         end if
  113.       end if
  114.     end repeat
  115.     set thenum to x
  116.     set anxx to item 1 of line anum of loclist
  117.     set anyy to item 2 of line anum of loclist
  118.     put "Used" into line anum of loclist
  119.     set the locH of sprite (thenum + 1) to value(anxx)
  120.     set the locV of sprite (thenum + 1) to value(anyy)
  121.     if (thenum = 16) and (acode = "M") then
  122.       set the visible of sprite (thenum + 1) to 0
  123.     end if
  124.   end repeat
  125.   cursor(-1)
  126. end
  127.  
  128. on MOVETHEITEM anum
  129.   set curmh to the mouseH
  130.   set curmv to the mouseV
  131.   set asprite to anum + 1
  132.   set curh to the locH of sprite asprite
  133.   set curv to the locV of sprite asprite
  134.   set aLeft to the left of sprite asprite
  135.   set aRight to the right of sprite asprite
  136.   set aTop to the top of sprite asprite
  137.   set abottom to the bottom of sprite asprite
  138.   set awidth to aRight - aLeft
  139.   set aheight to abottom - aTop
  140.   set halfwidth to integer(awidth)
  141.   set halfheight to integer(aheight)
  142.   set hdiff to curh - curmh
  143.   set vdiff to curv - curmv
  144.   puppetSound("TishLoop")
  145.   repeat while the mouseDown = 1
  146.     set newh to the mouseH + hdiff
  147.     set newv to the mouseV + vdiff
  148.     if (newh > 0) and (newh < (412 - awidth)) then
  149.       set the locH of sprite asprite to the mouseH + hdiff
  150.     else
  151.       if newh <= 0 then
  152.         set the locH of sprite asprite to 0
  153.       else
  154.         if newh >= (412 - awidth) then
  155.           set the locH of sprite asprite to 412 - awidth
  156.         else
  157.           set the locH of sprite asprite to the mouseH + hdiff
  158.         end if
  159.       end if
  160.     end if
  161.     if (newv > 0) and (newv < (384 - aheight)) then
  162.       set the locV of sprite asprite to the mouseV + vdiff
  163.     else
  164.       if newv <= 0 then
  165.         set the locV of sprite asprite to 0
  166.       else
  167.         if newv >= (384 - aheight) then
  168.           set the locV of sprite asprite to 384 - aheight
  169.         else
  170.           set the locV of sprite asprite to the mouseV + vdiff
  171.         end if
  172.       end if
  173.     end if
  174.     updateStage()
  175.   end repeat
  176.   sound stop 1
  177.   sound stop 2
  178.   CHECKWHEREITSLEFT(anum)
  179.   set finalpos to CHECKLOCATIONS()
  180.   if finalpos = "True" then
  181.     CYCLETHEIMAGE()
  182.   end if
  183. end
  184.  
  185. on GETLOCATIONLIST
  186.   set CURRENTMOVIE to the movie
  187.   set cnum to the number of chars in CURRENTMOVIE
  188.   set acode to char cnum of CURRENTMOVIE
  189.   if acode = "B" then
  190.     set theList to "0,0" & RETURN & "0,85" & RETURN & "0,192" & RETURN & "0,276" & RETURN & "103,0" & RETURN & "92,96" & RETURN & "103,181" & RETURN & "92,288" & RETURN & "195,0" & RETURN & "206,85" & RETURN & "195,192" & RETURN & "206,276" & RETURN & "309,0" & RETURN & "309,96" & RETURN & "297,181" & RETURN & "309,288"
  191.   else
  192.     if acode = "G" then
  193.       set theList to "51,48" & RETURN & "51,144" & RETURN & "51,240" & RETURN & "51,336" & RETURN & "154,48" & RETURN & "154,144" & RETURN & "154,240" & RETURN & "154,336" & RETURN & "257,48" & RETURN & "257,144" & RETURN & "257,240" & RETURN & "257,336" & RETURN & "360,48" & RETURN & "360,144" & RETURN & "360,240" & RETURN & "360,336"
  194.     else
  195.       if acode = "M" then
  196.         set theList to "51,48" & RETURN & "51,144" & RETURN & "51,240" & RETURN & "51,336" & RETURN & "154,48" & RETURN & "154,144" & RETURN & "154,240" & RETURN & "154,336" & RETURN & "257,48" & RETURN & "257,144" & RETURN & "257,240" & RETURN & "257,336" & RETURN & "360,48" & RETURN & "360,144" & RETURN & "360,240" & RETURN & "360,336"
  197.       else
  198.         if acode = "W" then
  199.           set theList to "0,0" & RETURN & "45,0" & RETURN & "133,0" & RETURN & "273,0" & RETURN & "0,76" & RETURN & "175,53" & RETURN & "111,118" & RETURN & "60,140" & RETURN & "276,112" & RETURN & "0,191" & RETURN & "133,173" & RETURN & "249,190" & RETURN & "0,231" & RETURN & "26,268" & RETURN & "151,277" & RETURN & "276,303"
  200.         end if
  201.       end if
  202.     end if
  203.   end if
  204.   return theList
  205. end
  206.  
  207. on CHECKPOSITIONS
  208.   set loclist to GETLOCATIONLIST()
  209.   repeat with x = 1 to 16
  210.     set tempx to item 1 of line x of loclist
  211.     set tempy to item 2 of line x of loclist
  212.     set asprite to x + 1
  213.     set curx to the locH of sprite asprite
  214.     set cury to the locV of sprite asprite
  215.     if (curx <> tempx) or (cury <> tempy) then
  216.       return "False"
  217.       exit
  218.     end if
  219.   end repeat
  220.   return "True"
  221. end
  222.  
  223. on CHECKLOCATIONS
  224.   set theList to GETLOCATIONLIST()
  225.   repeat with x = 1 to 16
  226.     set asprite to x + 1
  227.     set curx to the locH of sprite asprite
  228.     set cury to the locV of sprite asprite
  229.     set tempx to item 1 of line x of theList
  230.     set tempy to item 2 of line x of theList
  231.     if (curx <> tempx) or (cury <> tempy) then
  232.       return "False"
  233.     end if
  234.   end repeat
  235.   return "True"
  236. end
  237.  
  238. on CHECKWHEREITSLEFT anum
  239.   set theList to GETLOCATIONLIST()
  240.   set asprite to anum + 1
  241.   set curh to the locH of sprite asprite
  242.   set cury to the locV of sprite asprite
  243.   set destloc to line anum of theList
  244.   set destx to item 1 of destloc
  245.   set desty to item 2 of destloc
  246.   if (curh >= (destx - 10)) and (curh <= (destx + 10)) and ((cury >= (desty - 10)) and (cury <= (desty + 10))) then
  247.     set the locH of sprite asprite to value(destx)
  248.     set the locV of sprite asprite to value(desty)
  249.     updateStage()
  250.   end if
  251. end
  252.  
  253. on CYCLETHEIMAGE
  254.   set clist to "1,5,9,13,14,10,6,2,3,7,11,15,16,12,8,4"
  255.   puppetSound("Sparkle")
  256.   repeat with x = 1 to 16
  257.     set asprite to item x of clist
  258.     set asprite to value(asprite)
  259.     set actSprite to asprite + 1
  260.     set the ink of sprite actSprite to 6
  261.     updateStage()
  262.     if x <> 1 then
  263.       set inum to x - 1
  264.       set asprite to item inum of clist
  265.       set asprite to value(asprite)
  266.       set actSprite to asprite + 1
  267.       set the ink of sprite actSprite to 8
  268.       updateStage()
  269.     end if
  270.   end repeat
  271.   set asprite to item 16 of clist
  272.   set asprite to value(asprite)
  273.   set actSprite to asprite + 1
  274.   set the ink of sprite actSprite to 8
  275.   updateStage()
  276.   set cnum to the number of cast 17
  277.   set the castNum of sprite 2 to cnum
  278.   set the locH of sprite 2 to 206
  279.   set the locV of sprite 2 to 192
  280.   repeat with x = 3 to 17
  281.     set the visible of sprite x to 0
  282.   end repeat
  283.   sound stop 1
  284.   sound stop 2
  285.   updateStage()
  286. end
  287.  
  288. on FIGURETHELIST anum
  289.   set blankh to the locH of sprite 17
  290.   set blankv to the locV of sprite 17
  291.   set asprite to anum + 1
  292.   set clickh to the locH of sprite asprite
  293.   set clickv to the locV of sprite asprite
  294.   set temph to clickh
  295.   set tempv to clickv
  296.   if blankh > clickh then
  297.     set hdiff to 103
  298.   else
  299.     if blankh < clickh then
  300.       set hdiff to -103
  301.     else
  302.       set hdiff to 0
  303.     end if
  304.   end if
  305.   if blankv > clickv then
  306.     set vdiff to 96
  307.   else
  308.     if blankv < clickv then
  309.       set vdiff to -96
  310.     else
  311.       set vdiff to 0
  312.     end if
  313.   end if
  314.   set cordlist to clickh & "," & clickv & RETURN
  315.   repeat with x = 1 to 4
  316.     set temph to temph + hdiff
  317.     set tempv to tempv + vdiff
  318.     if (temph = blankh) and (tempv = blankv) then
  319.       exit repeat
  320.     end if
  321.     set cordlist to cordlist & temph & "," & tempv & RETURN
  322.   end repeat
  323.   set cnum to the number of lines in cordlist
  324.   set thedata to EMPTY
  325.   repeat with x = 1 to 15
  326.     set asprite to x + 1
  327.     set testh to the locH of sprite asprite
  328.     set testv to the locV of sprite asprite
  329.     set astr to testh & "," & testv
  330.     if cordlist contains astr then
  331.       repeat with y = 1 to cnum
  332.         if line y of cordlist = astr then
  333.           put x & "," & testh & "," & testv into line y of thedata
  334.           exit repeat
  335.         end if
  336.       end repeat
  337.     end if
  338.     if the number of lines in thedata = 4 then
  339.       exit repeat
  340.     end if
  341.   end repeat
  342.   return thedata
  343. end
  344.  
  345. on MIXANDMATCH anum
  346.   set CURRENTMOVIE to the movie
  347.   set cnum to the number of chars in CURRENTMOVIE
  348.   set acode to char cnum of CURRENTMOVIE
  349.   if acode = "M" then
  350.     MIXMANDMATCH(anum)
  351.   else
  352.     if acode = "G" then
  353.       MIXGANDMATCH(anum)
  354.     end if
  355.   end if
  356. end
  357.  
  358. on MIXMANDMATCH anum
  359.   set blankh to the locH of sprite 17
  360.   set blankv to the locV of sprite 17
  361.   set asprite to anum + 1
  362.   set clickh to the locH of sprite asprite
  363.   set clickv to the locV of sprite asprite
  364.   if (clickh = blankh) and (clickv = blankv) then
  365.     exit
  366.   end if
  367.   puppetSound("Puz2")
  368.   set the ink of sprite asprite to 6
  369.   updateStage()
  370.   delay(20)
  371.   set the ink of sprite asprite to 8
  372.   updateStage()
  373.   if (blankh = clickh) or (blankv = clickv) then
  374.     set theList to FIGURETHELIST(anum)
  375.   else
  376.     set hdiff to clickh - blankh
  377.     set vdiff to clickv - blankv
  378.     set htimes to hdiff / 103
  379.     set vtimes to vdiff / 96
  380.     if htimes < 0 then
  381.       set htimes to htimes * -1
  382.     end if
  383.     if vtimes < 0 then
  384.       set vtimes to vtimes * -1
  385.     end if
  386.     if htimes <> vtimes then
  387.       exit
  388.     end if
  389.     set theList to FIGURETHELIST(anum)
  390.   end if
  391.   puppetSound("Puz3")
  392.   set lnum to the number of lines in theList
  393.   repeat with x = 1 to lnum
  394.     set asprite to item 1 of line x of theList
  395.     if x <> lnum then
  396.       set anh to item 2 of line x + 1 of theList
  397.       set any to item 3 of line x + 1 of theList
  398.     else
  399.       set anh to blankh
  400.       set any to blankv
  401.     end if
  402.     set asprite to integer(asprite)
  403.     set anh to integer(anh)
  404.     set anv to integer(any)
  405.     set asprite to asprite + 1
  406.     set the locH of sprite asprite to anh
  407.     set the locV of sprite asprite to anv
  408.   end repeat
  409.   set the locH of sprite 17 to clickh
  410.   set the locV of sprite 17 to clickv
  411.   updateStage()
  412.   set aRes to CHECKPOSITIONS()
  413.   if aRes = "True" then
  414.     CYCLETHEIMAGE()
  415.   end if
  416. end
  417.  
  418. on MIXGANDMATCH anum
  419.   global ITEM1, ITEM2
  420.   if ITEM1 = EMPTY then
  421.     set ITEM1 to anum
  422.     puppetSound("Puz2")
  423.     set asprite to anum + 1
  424.     set the ink of sprite asprite to 6
  425.     updateStage()
  426.     exit
  427.   end if
  428.   if ITEM1 = anum then
  429.     set ITEM1 to EMPTY
  430.     puppetSound("Puz2")
  431.     set asprite to anum + 1
  432.     set the ink of sprite asprite to 8
  433.     updateStage()
  434.     exit
  435.   end if
  436.   set asprite to ITEM1 + 1
  437.   set the ink of sprite asprite to 8
  438.   set asprite to anum + 1
  439.   set tempx to the locH of sprite asprite
  440.   set tempy to the locV of sprite asprite
  441.   puppetSound("Puz3")
  442.   set the locH of sprite asprite to the locH of sprite (ITEM1 + 1)
  443.   set the locV of sprite asprite to the locV of sprite (ITEM1 + 1)
  444.   set asprite to ITEM1 + 1
  445.   set the locH of sprite asprite to tempx
  446.   set the locV of sprite asprite to tempy
  447.   set ITEM1 to EMPTY
  448.   updateStage()
  449.   set aRes to CHECKPOSITIONS()
  450.   if aRes = "True" then
  451.     CYCLETHEIMAGE()
  452.   end if
  453. end
  454.