home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / studiosw / origgame / catscon.dxr / 00001.ls next >
Encoding:
Text File  |  1996-04-17  |  4.4 KB  |  181 lines

  1. global gGameBoard, gGameInPlay, gArt, gDirA, gDirB, gDirC, gTimeOut, gRWindow, gOriginalColorDepth
  2.  
  3. on startMovie
  4.   set gTimeOut to 60
  5.   set gDirA to 1
  6.   set gDirB to -1
  7.   set gDirC to 1
  8.   set gGameInPlay to 0
  9.   set the stageColor to 25
  10.   set gArt to 1
  11.   set counter to 30
  12.   repeat while counter < 42
  13.     puppetSprite(counter, 1)
  14.     set counter to counter + 1
  15.   end repeat
  16.   puppetSprite(45, 1)
  17.   puppetSprite(46, 1)
  18.   puppetSprite(47, 1)
  19.   Init()
  20.   InitGameBoard()
  21. end
  22.  
  23. on stopMovie
  24.   killGame(gGameBoard)
  25.   set gGameBoard to 0
  26.   kill()
  27. end
  28.  
  29. on Init
  30.   set gOriginalColorDepth to the colorDepth
  31.   set the colorDepth to 8
  32.   if the machineType < 255 then
  33.     openXLib(the pathName & "RearWindow.XObj")
  34.     set gRWindow to RearWindow(mnew, "S")
  35.     gRWindow(mRGBColorToWindow, 255, 255, 255)
  36.   end if
  37. end
  38.  
  39. on kill
  40.   set the colorDepth to gOriginalColorDepth
  41.   if the machineType < 255 then
  42.     gRWindow(mdispose)
  43.     closeXLib(the pathName & "RearWindow.XObj")
  44.   end if
  45. end
  46.  
  47. on goPur
  48.   puppetSound("pur.aiff")
  49.   set thisSprite to the clickOn
  50.   set holdCast to the castNum of sprite thisSprite
  51.   set the castNum of sprite thisSprite to 104
  52.   updateStage()
  53.   repeat while the mouseDown and rollOver(thisSprite)
  54.   end repeat
  55.   set the castNum of sprite thisSprite to holdCast
  56.   if rollOver(thisSprite) then
  57.     do(RETURN)
  58.   end if
  59. end
  60.  
  61. on goMeow
  62.   puppetSound("meow2.aiff")
  63.   set thisSprite to the clickOn
  64.   set holdCast to the castNum of sprite thisSprite
  65.   set the castNum of sprite thisSprite to 126
  66.   updateStage()
  67.   repeat while the mouseDown and rollOver(thisSprite)
  68.   end repeat
  69.   set the castNum of sprite thisSprite to holdCast
  70.   if rollOver(thisSprite) then
  71.     do(RETURN)
  72.   end if
  73. end
  74.  
  75. on InitGameBoard
  76.   set gGameBoard to birth(script "aGameBrd", 75, 1, 48)
  77.   set theCast to 188
  78.   set theRevCast to 188
  79.   createNewGame(gGameBoard, theCast, 6, 5, 198, theRevCast)
  80.   startTimer()
  81. end
  82.  
  83. on doGMouseDown theSprite
  84.   if gGameInPlay then
  85.     doMouseDown(gGameBoard, theSprite)
  86.   end if
  87. end
  88.  
  89. on reset
  90.   reset(gGameBoard)
  91. end
  92.  
  93. on PlayGame
  94.   puppetSound("meow1.aiff")
  95.   set thisSprite to the clickOn
  96.   set holdCast to the castNum of sprite thisSprite
  97.   set the castNum of sprite thisSprite to 115
  98.   updateStage()
  99.   repeat while the mouseDown and rollOver(thisSprite)
  100.   end repeat
  101.   if rollOver(thisSprite) then
  102.     StartANewGame(gGameBoard)
  103.     set gGameInPlay to 1
  104.     set gTimeOut to 5 * 60
  105.     go("playGame")
  106.   end if
  107.   set the castNum of sprite thisSprite to holdCast
  108.   updateStage()
  109. end
  110.  
  111. on doSwapART
  112.   killGame(gGameBoard)
  113.   if gArt = 1 then
  114.     set theCast to 81
  115.     set theRevCast to 41
  116.     set gArt to 2
  117.   else
  118.     set theCast to 144
  119.     set theRevCast to 81
  120.     set gArt to 1
  121.   end if
  122.   createNewGame(gGameBoard, theCast, 6, 5, theCast + 16, theRevCast)
  123. end
  124.  
  125. on idle
  126.   if the timer > gTimeOut then
  127.     wiggleButtons()
  128.     if gGameInPlay then
  129.       doTick(gGameBoard)
  130.     else
  131.       scrambleTwoTiles(gGameBoard)
  132.     end if
  133.     doNenoLights()
  134.     startTimer()
  135.   end if
  136. end
  137.  
  138. on doNenoLights
  139.   set theSeed_Inner to random(3)
  140.   set theSeed_Middle to random(3)
  141.   set theSeed_Outer to random(3)
  142.   set the castNum of sprite 30 to 55 + theSeed_Inner
  143.   set the castNum of sprite 31 to 58 + theSeed_Middle
  144.   set the castNum of sprite 32 to 61 + theSeed_Outer
  145.   set the castNum of sprite 33 to 66 + theSeed_Inner
  146.   set the castNum of sprite 34 to 69 + theSeed_Middle
  147.   set the castNum of sprite 35 to 72 + theSeed_Outer
  148.   set the castNum of sprite 36 to 77 + theSeed_Inner
  149.   set the castNum of sprite 37 to 80 + theSeed_Middle
  150.   set the castNum of sprite 38 to 83 + theSeed_Outer
  151.   set the castNum of sprite 39 to 88 + theSeed_Inner
  152.   set the castNum of sprite 40 to 91 + theSeed_Middle
  153.   set the castNum of sprite 41 to 94 + theSeed_Outer
  154. end
  155.  
  156. on wiggleButtons
  157.   set gDirA to wiggleThisButton(45, 112, 114, gDirA)
  158.   set gDirB to wiggleThisButton(46, 123, 125, gDirB)
  159.   set gDirC to wiggleThisButton(47, 101, 103, gDirC)
  160. end
  161.  
  162. on wiggleThisButton theSprite, minCast, maxCast, theDelta
  163.   set holdCast to the castNum of sprite theSprite
  164.   if theDelta > 0 then
  165.     if holdCast = maxCast then
  166.       set theDelta to -1
  167.       set the castNum of sprite theSprite to holdCast - 1
  168.     else
  169.       set the castNum of sprite theSprite to holdCast + 1
  170.     end if
  171.   else
  172.     if holdCast = minCast then
  173.       set theDelta to 1
  174.       set the castNum of sprite theSprite to holdCast + 1
  175.     else
  176.       set the castNum of sprite theSprite to holdCast - 1
  177.     end if
  178.   end if
  179.   return theDelta
  180. end
  181.