home *** CD-ROM | disk | FTP | other *** search
/ Imagination Express: Destination Pyramids / PYRAMIDS.ISO / THEMES / PYRAMIDS / SS / IDEAS.EXE / IDEAS.DXR / 00001.ls next >
Encoding:
Text File  |  1996-02-21  |  6.5 KB  |  246 lines

  1. on startMovie
  2.   global gMoovQty, gPreroll, gMovieLoc, gMoovRoot, gBkgdRoot, gIdeaPictSprite, gMovieSprite, gStopSprite, gPlaySprite, gRepeatSprite
  3.   clearGlobals()
  4.   cursor(0)
  5.   cursor(4)
  6.   set gMoovQty to 41
  7.   set gMovieLoc to [138, 44]
  8.   set gMoovRoot to "PYRMD"
  9.   set gBkgdRoot to "PSIV"
  10.   set gIdeaPictSprite to 2
  11.   set gMovieSprite to 5
  12.   set gStopSprite to 8
  13.   set gPlaySprite to 9
  14.   set gRepeatSprite to 10
  15.   preLoadCast(42, 48)
  16.   clearMoovPlayList()
  17.   set the mouseDownScript to "lockMouseDownScript"
  18.   set the mouseUpScript to "lockMouseUpScript"
  19.   initializeQtMovies()
  20. end
  21.  
  22. on keyDown
  23.   dontPassEvent()
  24. end
  25.  
  26. on keyUp
  27.   dontPassEvent()
  28. end
  29.  
  30. on mouseDown
  31.   global gSpriteNumber, gStopSprite, gPlaySprite, gRepeatSprite
  32.   set gSpriteNumber to the clickOn
  33.   set UpcastNum to the castNum of sprite gSpriteNumber
  34.   set downCastNum to UpcastNum + 1
  35.   if (gSpriteNumber = gStopSprite) or (gSpriteNumber = gPlaySprite) or (gSpriteNumber = gRepeatSprite) then
  36.     set the castNum of sprite gSpriteNumber to downCastNum
  37.     updateStage()
  38.     repeat while the mouseDown
  39.       if not rollOver(gSpriteNumber) then
  40.         set the castNum of sprite gSpriteNumber to UpcastNum
  41.         updateStage()
  42.         next repeat
  43.       end if
  44.       set the castNum of sprite gSpriteNumber to downCastNum
  45.       updateStage()
  46.     end repeat
  47.     set the castNum of sprite gSpriteNumber to UpcastNum
  48.   end if
  49. end
  50.  
  51. on lockMouseUpscript
  52.   set the mouseUpScript to EMPTY
  53.   dontPassEvent()
  54. end
  55.  
  56. on lockMousedownscript
  57.   set the mouseDownScript to EMPTY
  58.   dontPassEvent()
  59. end
  60.  
  61. on mouseUp
  62.   global gSpriteNumber, clicksprite, gJumpFlag, gIdeaPictSprite, gStopSprite, gPlaySprite, gRepeatSprite
  63.   if the clickOn = 0 then
  64.     dontPassEvent()
  65.     exit
  66.   end if
  67.   set gSpriteNumber to the clickOn
  68.   set UpcastNum to the castNum of sprite gSpriteNumber
  69.   set downCastNum to UpcastNum + 1
  70.   set the mouseDownScript to "lockMouseDownScript"
  71.   set the mouseUpScript to "lockMouseUpScript"
  72.   if (gSpriteNumber = gPlaySprite) and rollOver(gPlaySprite) then
  73.     if the frameLabel = "wait" then
  74.       go("random")
  75.     end if
  76.   else
  77.     if (gSpriteNumber = gRepeatSprite) and rollOver(gRepeatSprite) then
  78.       go("setup")
  79.     else
  80.       if (gSpriteNumber = gStopSprite) and rollOver(gStopSprite) then
  81.         set the castNum of sprite gStopSprite to the number of cast "nstopu"
  82.         puppetSprite(gIdeaPictSprite, 0)
  83.         updateStage()
  84.         go("stop")
  85.         quit()
  86.       else
  87.         lockMousedownscript()
  88.         lockMouseUpscript()
  89.       end if
  90.     end if
  91.   end if
  92.   updateStage()
  93. end
  94.  
  95. on initializeQtMovies
  96.   global gMoovQty, gMoovRoot
  97.   cursor(0)
  98.   cursor(4)
  99.   repeat with x = 1 to gMoovQty
  100.     set movieName to gMoovRoot & x
  101.     set the directToStage of cast movieName to 1
  102.     set the pausedAtStart of cast movieName to 1
  103.     set the preLoad of cast movieName to 1
  104.   end repeat
  105. end
  106.  
  107. on randomSetup
  108.   global gMoovNameNum, gMoovQty, gMoovPlayList, gMoovPlayListCounter, gFirstFrameNum, gLastFrameNum, bkgdname, gMoovRoot, gBkgdRoot
  109.   cursor(4)
  110.   set successFlag to 0
  111.   repeat while successFlag = 0
  112.     set newMoovNumber to random(gMoovQty)
  113.     if getAt(gMoovPlayList, newMoovNumber) = 0 then
  114.       setAt(gMoovPlayList, newMoovNumber, 1)
  115.       set gMoovNameNum to the number of cast (gMoovRoot & newMoovNumber)
  116.       set gMoovPlayListCounter to gMoovPlayListCounter + 1
  117.       set successFlag to 1
  118.     end if
  119.   end repeat
  120.   if gMoovPlayListCounter = gMoovQty then
  121.     clearMoovPlayList()
  122.   end if
  123.   set bkgdname to gBkgdRoot & newMoovNumber
  124. end
  125.  
  126. on moovSetup
  127.   global gFirstFrameNum, gMoovNameNum, gPreroll, gMovielength
  128.   cursor(0)
  129.   cursor(4)
  130.   updateStage()
  131. end
  132.  
  133. on playMoov
  134.   global gMoovNameNum, gMovieLoc, gMovieSprite
  135.   set myMovieLoc to gMovieLoc
  136.   set whichMovieCast to gMoovNameNum
  137.   playMyMoov(gMovieSprite, myMovieLoc, whichMovieCast)
  138. end
  139.  
  140. on playMyMoov whichsprite, movieLoc, whichMovieCast
  141.   cursor(4)
  142.   set dummyCast to 19
  143.   go(the frame)
  144.   puppetSprite(whichsprite, 1)
  145.   set spriteWidth to the width of cast whichMovieCast
  146.   set spriteHeight to the height of cast whichMovieCast
  147.   set spriteLeft to getAt(movieLoc, 1) + value(spriteWidth / 2)
  148.   set spriteTop to getAt(movieLoc, 1) + value(spriteHeight / 2)
  149.   set spriteLeft to getAt(movieLoc, 1)
  150.   set spriteTop to getAt(movieLoc, 2)
  151.   set spriteRight to spriteLeft + spriteWidth
  152.   set spriteBottom to spriteTop + spriteHeight
  153.   spriteBox(whichsprite, -500, -500, -500 + 124, -500 + 120)
  154.   updateStage()
  155.   set the castNum of sprite whichsprite to whichMovieCast
  156.   spriteBox(whichsprite, spriteLeft, spriteTop, spriteRight, spriteBottom)
  157.   updateStage()
  158.   set clickTest to 0
  159.   set movieLen to the duration of cast whichMovieCast
  160.   set the movieRate of sprite whichsprite to 1
  161.   repeat while the movieTime of sprite whichsprite < movieLen
  162.     if the mouseDown then
  163.       set clickTest to 1
  164.       exit repeat
  165.     end if
  166.     updateStage()
  167.   end repeat
  168.   set the movieRate of sprite whichsprite to 0
  169.   unLoadCast(whichMovieCast)
  170.   set the castNum of sprite whichsprite to dummyCast
  171.   if clickTest = 0 then
  172.     lockMousedownscript()
  173.     lockMouseUpscript()
  174.   end if
  175.   spriteBox(whichsprite, 0, 0, 640, 480)
  176.   updateStage()
  177.   clearbkgnd()
  178.   spriteBox(whichsprite, -200, -200, 100, 100)
  179.   updateStage()
  180.   puppetSprite(whichsprite, 0)
  181.   cursor(0)
  182.   go(the frame + 1)
  183. end
  184.  
  185. on moovStatus
  186.   global gMovielength, gLastFrameNum, gMoovNameNum, gMovieSprite
  187.   set gJumpFlag to 1
  188.   set the locH of sprite gMovieSprite to -200
  189.   unLoadCast(gMoovNameNum)
  190.   puppetSprite(gMovieSprite, 0)
  191.   updateStage()
  192. end
  193.  
  194. on stopMoov
  195.   global gMovieSprite
  196.   killSprite(gMovieSprite)
  197.   clearbkgnd()
  198.   updateStage()
  199. end
  200.  
  201. on checkForJump
  202.   global gJumpFlag
  203.   if gJumpFlag = 1 then
  204.     set gJumpFlag to 0
  205.     go("random")
  206.   end if
  207. end
  208.  
  209. on clearMoovPlayList
  210.   global gMoovPlayList, gMoovQty, gMoovPlayListCounter
  211.   set gMoovPlayList to list(0)
  212.   setAt(gMoovPlayList, gMoovQty, 0)
  213.   set gMoovPlayListCounter to 0
  214. end
  215.  
  216. on killSprite whichsprite
  217.   set the locH of sprite whichsprite to -500
  218.   set the locV of sprite whichsprite to -500
  219.   puppetSprite(whichsprite, 0)
  220.   updateStage()
  221. end
  222.  
  223. on keepbkgd
  224.   global bkgdname, gIdeaPictSprite
  225.   puppetSprite(gIdeaPictSprite, 1)
  226.   set the castNum of sprite gIdeaPictSprite to the number of cast bkgdname
  227.   set the stretch of sprite gIdeaPictSprite to 1
  228.   spriteBox(gIdeaPictSprite, 329, 0, 640, 273)
  229.   updateStage()
  230. end
  231.  
  232. on clearbkgnd
  233.   global bkgdname, gIdeaPictSprite
  234.   unLoadCast(2)
  235.   set the castNum of sprite gIdeaPictSprite to 34
  236.   set the stretch of sprite gIdeaPictSprite to 1
  237.   spriteBox(gIdeaPictSprite, 329, 0, 640, 273)
  238.   updateStage()
  239. end
  240.  
  241. on mydelay numticks
  242.   startTimer()
  243.   repeat while the timer < numticks
  244.   end repeat
  245. end
  246.