home *** CD-ROM | disk | FTP | other *** search
/ 1,000 Games / Disc1.iso / ADVEN / STRIPME / STRIPME.EXE / BUILDME.DXR / 00118.ls < prev    next >
Encoding:
Text File  |  1996-01-11  |  7.4 KB  |  256 lines

  1. on startMovie
  2.   global gPlayer, gTimeOut
  3.   set gPlayer to 1
  4.   set gTimeOut to 600
  5. end
  6.  
  7. on getCard
  8.   global gCard
  9.   set gCard to random(9)
  10.   return gCard
  11. end
  12.  
  13. on registerCard
  14.   global gCardNum
  15.   set gCardNum to chars(the name of cast the castNum of sprite 2, 1, 3)
  16. end
  17.  
  18. on init
  19.   global gTimeCount, gDirs, gBigCards, gFirstHead, gFirstProp, gFirstBack, gFirstBody, gHeads, gProps, gBacks, gBodys
  20.   set gTimeCount to 0
  21.   set gDirs to [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
  22.   set gBigCards to [1, 1, 1, 1]
  23.   set gFirstHead to 3
  24.   set gFirstProp to 3
  25.   set gFirstBack to 3
  26.   set gFirstBody to 3
  27.   set gHeads to [27, 19, 7, 38, 50, 60, 71, 81, 92]
  28.   set gProps to [30, 22, 10, 41, 53, 63, 75, 84, 95]
  29.   set gBacks to [23, 13, 3, 33, 45, 56, 66, 77, 87]
  30.   set gBodys to [24, 16, 4, 35, 47, 57, 68, 78, 89]
  31.   startTimer()
  32. end
  33.  
  34. on animCards
  35.   global gDirs
  36.   repeat with i = 17 to 28
  37.     set n to the name of cast the castNum of sprite i
  38.     set nn to the name of cast (the castNum of sprite i + getAt(gDirs, i - 16))
  39.     if chars(n, 1, 8) = chars(nn, 1, 8) then
  40.       set the castNum of sprite i to the castNum of sprite i + getAt(gDirs, i - 16)
  41.     else
  42.       setAt(gDirs, i - 16, 0 - getAt(gDirs, i - 16))
  43.     end if
  44.     proportionalStretch(i, i - 16)
  45.     if sprite 39 intersects i then
  46.       if the mouseDown then
  47.         deleteBigCard(i)
  48.         set the width of sprite i to the width of cast the castNum of sprite i
  49.         set the height of sprite i to the height of cast the castNum of sprite i
  50.       else
  51.         setBigCard(i)
  52.         RainaltsWonder(i, i - 16)
  53.         if checkIt() then
  54.           setAntenne()
  55.           goStrip()
  56.           abort()
  57.         end if
  58.       end if
  59.       next repeat
  60.     end if
  61.     RainaltsWonder(i, i - 16)
  62.   end repeat
  63.   repeat with i = 13 to 16
  64.     set n to the name of cast the castNum of sprite i
  65.     set nn to the name of cast (the castNum of sprite i + getAt(gDirs, i - 12))
  66.     if chars(n, 1, 8) = chars(nn, 1, 8) then
  67.       set the castNum of sprite i to the castNum of sprite i + getAt(gDirs, i - 12)
  68.       next repeat
  69.     end if
  70.     setAt(gDirs, i - 12, 0 - getAt(gDirs, i - 12))
  71.   end repeat
  72.   updateStage()
  73. end
  74.  
  75. on setBigCard sp
  76.   global gBigCards
  77.   if the name of cast the castNum of sprite sp contains "head" then
  78.     set the castNum of sprite 16 to the castNum of sprite sp
  79.     set the stretch of sprite 16 to 0
  80.     set the locH of sprite 16 to the locH of sprite sp
  81.     set the locV of sprite 16 to the locV of sprite sp
  82.     setAt(gBigCards, 4, the castNum of sprite sp)
  83.   end if
  84.   if the name of cast the castNum of sprite sp contains "back" then
  85.     set the castNum of sprite 13 to the castNum of sprite sp
  86.     set the stretch of sprite 13 to 0
  87.     set the locH of sprite 13 to the locH of sprite 39
  88.     set the locV of sprite 13 to the locV of sprite 39
  89.     setAt(gBigCards, 1, the castNum of sprite sp)
  90.   end if
  91.   if the name of cast the castNum of sprite sp contains "body" then
  92.     set the castNum of sprite 14 to the castNum of sprite sp
  93.     set the stretch of sprite 14 to 0
  94.     set the locH of sprite 14 to the locH of sprite sp
  95.     set the locV of sprite 14 to the locV of sprite sp
  96.     setAt(gBigCards, 2, the castNum of sprite sp)
  97.   end if
  98.   if the name of cast the castNum of sprite sp contains "prop" then
  99.     set the castNum of sprite 15 to the castNum of sprite sp
  100.     set the stretch of sprite 15 to 0
  101.     set the locH of sprite 15 to the locH of sprite sp
  102.     set the locV of sprite 15 to the locV of sprite sp
  103.     setAt(gBigCards, 3, the castNum of sprite sp)
  104.   end if
  105. end
  106.  
  107. on deleteBigCard sp
  108.   global gBigCards
  109.   if the name of cast the castNum of sprite sp contains "head" then
  110.     set the locH of sprite 16 to 1000
  111.     set the locV of sprite 28 to 1000
  112.   end if
  113.   if the name of cast the castNum of sprite sp contains "back" then
  114.     set the locH of sprite 13 to 1000
  115.     set the locV of sprite 13 to 1000
  116.   end if
  117.   if the name of cast the castNum of sprite sp contains "body" then
  118.     set the locH of sprite 14 to 1000
  119.     set the locV of sprite 14 to 1000
  120.   end if
  121.   if the name of cast the castNum of sprite sp contains "prop" then
  122.     set the locH of sprite 15 to 1000
  123.     set the locV of sprite 15 to 1000
  124.   end if
  125. end
  126.  
  127. on scrollCards
  128.   global gFirstHead, gFirstProp, gFirstBack, gFirstBody, gHeads, gProps, gBacks, gBodys
  129.   if rollOver(31) then
  130.     set gFirstHead to dec(gFirstHead, 1, 9)
  131.     scrollIt(23, gHeads, gFirstHead, 3)
  132.   end if
  133.   if rollOver(32) then
  134.     set gFirstHead to inc(gFirstHead, 1, 9)
  135.     scrollIt(23, gHeads, gFirstHead, 3)
  136.   end if
  137.   if rollOver(33) then
  138.     set gFirstProp to dec(gFirstProp, 1, 9)
  139.     scrollIt(26, gProps, gFirstProp, 3)
  140.   end if
  141.   if rollOver(34) then
  142.     set gFirstProp to inc(gFirstProp, 1, 9)
  143.     scrollIt(26, gProps, gFirstProp, 3)
  144.   end if
  145.   if rollOver(35) then
  146.     set gFirstBack to dec(gFirstBack, 1, 9)
  147.     scrollIt(17, gBacks, gFirstBack, 3)
  148.   end if
  149.   if rollOver(36) then
  150.     set gFirstBack to inc(gFirstBack, 1, 9)
  151.     scrollIt(17, gBacks, gFirstBack, 3)
  152.   end if
  153.   if rollOver(37) then
  154.     set gFirstBody to dec(gFirstBody, 1, 9)
  155.     scrollIt(20, gBodys, gFirstBody, 3)
  156.   end if
  157.   if rollOver(38) then
  158.     set gFirstBody to inc(gFirstBody, 1, 9)
  159.     scrollIt(20, gBodys, gFirstBody, 3)
  160.   end if
  161. end
  162.  
  163. on scrollIt sp, li, be, n
  164.   set ret to getListAt(li, 1, count(li), be, n)
  165.   repeat with i = 1 to n
  166.     set the castNum of sprite (i + sp - 1) to getAt(ret, i)
  167.     proportionalStretch(i + sp - 1, i + sp - 1 - 16)
  168.     RainaltsWonder(i + sp - 1, i + sp - 1 - 16)
  169.   end repeat
  170. end
  171.  
  172. on RainaltsWonder x, y
  173.   if not (the mouseDown) then
  174.     set the locH of sprite x to the locH of sprite y
  175.     set the locV of sprite x to the locV of sprite y
  176.   end if
  177. end
  178.  
  179. on bigCardsNames
  180.   global gBigCards
  181.   set ret to EMPTY
  182.   repeat with i = 1 to 4
  183.     set ret to ret && the name of cast getAt(gBigCards, i)
  184.   end repeat
  185.   return ret
  186. end
  187.  
  188. on proportionalStretch org, dest
  189.   set coefX to the width of sprite dest / float(the width of cast the castNum of sprite org)
  190.   set coefY to the height of sprite dest / float(the height of cast the castNum of sprite org)
  191.   if min(coefX, coefY) < 1 then
  192.     set the width of sprite org to the width of cast the castNum of sprite org * min(coefX, coefY)
  193.     set the height of sprite org to the height of cast the castNum of sprite org * min(coefX, coefY)
  194.   else
  195.     set the width of sprite org to the width of cast the castNum of sprite org
  196.     set the height of sprite org to the height of cast the castNum of sprite org
  197.   end if
  198. end
  199.  
  200. on inc n, mn, mx
  201.   set n to n + 1
  202.   if n > mx then
  203.     set n to mn
  204.   end if
  205.   return n
  206. end
  207.  
  208. on dec n, mn, mx
  209.   set n to n - 1
  210.   if n < mn then
  211.     set n to mx
  212.   end if
  213.   return n
  214. end
  215.  
  216. on getListAt refList, sta, sto, ir, n
  217.   set ret to list()
  218.   set x to ir
  219.   repeat with i = 1 to n
  220.     addAt(ret, i, getAt(refList, x))
  221.     set x to x + 1
  222.     if x > sto then
  223.       set x to sta
  224.     end if
  225.   end repeat
  226.   return ret
  227. end
  228.  
  229. on checkIt
  230.   global gBigCards, gCardNum
  231.   repeat with i = 1 to 4
  232.     if chars(the name of cast getAt(gBigCards, i), 1, 3) <> gCardNum then
  233.       return 0
  234.     end if
  235.   end repeat
  236.   return 1
  237. end
  238.  
  239. on MoveTime
  240.   global gTimeOut, gTimeCount, gPlayer
  241.   if the timer > gTimeOut then
  242.     startTimer()
  243.     set gTimeCount to gTimeCount + 1
  244.     if gTimeCount > 15 then
  245.       go(the frame + 1)
  246.     end if
  247.     if gPlayer = 1 then
  248.       set the castNum of sprite 30 to cast "time 0"
  249.       set the castNum of sprite 29 to cast ("time" && 1 + (gTimeCount mod 9))
  250.     else
  251.       set the castNum of sprite 29 to cast "time 0"
  252.       set the castNum of sprite 30 to cast ("time" && 1 + (gTimeCount mod 9))
  253.     end if
  254.   end if
  255. end
  256.