home *** CD-ROM | disk | FTP | other *** search
/ Innerspace / Innerspace.iso / SHARED.DIR / 01000.ls next >
Encoding:
Text File  |  1994-12-14  |  4.0 KB  |  153 lines

  1. on scramb startCast
  2.   global spriteCnt, spriteHolder, randNum
  3.   set randNum to 0
  4.   set spriteCnt to 1
  5.   set spriteHolder to " "
  6.   repeat while spriteCnt <= 9
  7.     set randNum to random(9)
  8.     if CheckDup(randNum) then
  9.       nothing()
  10.       next repeat
  11.     end if
  12.     put randNum & " " into word spriteCnt of spriteHolder
  13.     set x to word spriteCnt of spriteHolder
  14.     set x to x * 1
  15.     set spriteCnt to spriteCnt + 1
  16.     set the castNum of sprite spriteCnt to startCast + randNum
  17.     updateStage()
  18.   end repeat
  19. end
  20.  
  21. on CheckDup whichSprite
  22.   global spriteHolder
  23.   set y to 1
  24.   repeat while y <= 9
  25.     set tempResult to word y of spriteHolder
  26.     set tempResult to tempResult * 1
  27.     set answer to tempResult - whichSprite
  28.     if answer = 0 then
  29.       return 1
  30.     else
  31.       nothing()
  32.     end if
  33.     set y to y + 1
  34.   end repeat
  35.   return 0
  36. end
  37.  
  38. on checkClick
  39.   global i
  40.   set i to the clickOn
  41. end
  42.  
  43. on MakeInvisible begSprite, endSprite, trueOrFalse
  44.   repeat with index = begSprite to endSprite
  45.     set the visible of sprite index to trueOrFalse
  46.   end repeat
  47. end
  48.  
  49. on makePuppet begSprite, endSprite, trueOrFalse
  50.   repeat with index = begSprite to endSprite
  51.     set the immediate of sprite index to trueOrFalse
  52.     puppetSprite(index, trueOrFalse)
  53.   end repeat
  54. end
  55.  
  56. on slowMove whichSprt, vert, horz, speed
  57.   set flag to 0
  58.   set horzloc to the locH of sprite whichSprt
  59.   set vertloc to the locV of sprite whichSprt
  60.   if the locH of sprite whichSprt < horz then
  61.     repeat while the locH of sprite whichSprt < horz
  62.       set horzloc to horzloc + speed
  63.       set the locH of sprite whichSprt to horzloc
  64.       updateStage()
  65.     end repeat
  66.   else
  67.     if the locH of sprite whichSprt > horz then
  68.       repeat while the locH of sprite whichSprt > horz
  69.         set horzloc to horzloc - speed
  70.         set the locH of sprite whichSprt to horzloc
  71.         updateStage()
  72.       end repeat
  73.     end if
  74.   end if
  75.   if the locV of sprite whichSprt < vert then
  76.     repeat while the locV of sprite whichSprt < vert
  77.       set vertloc to vertloc + speed
  78.       set the locV of sprite whichSprt to vertloc
  79.       updateStage()
  80.     end repeat
  81.   else
  82.     if the locV of sprite whichSprt > vert then
  83.       repeat while the locV of sprite whichSprt > vert
  84.         set vertloc to vertloc - speed
  85.         set the locV of sprite whichSprt to vertloc
  86.         updateStage()
  87.       end repeat
  88.     end if
  89.   end if
  90. end
  91.  
  92. on MoveTheSprite topV, topH, topIntV, topIntH, whichSprite, whichSound, maxCnt
  93.   global done, currCount, inPlace
  94.   puppetSound("Zip By.AIFF")
  95.   set topIntV to the locV of sprite the clickOn
  96.   set topIntH to the locH of sprite the clickOn
  97.   repeat while the mouseDown
  98.     set the locH of sprite the clickOn to the mouseH
  99.     set the locV of sprite the clickOn to the mouseV
  100.     updateStage()
  101.   end repeat
  102.   if sprite the clickOn intersects whichSprite then
  103.     set inPlace to 1
  104.     puppetSound(whichSound)
  105.     slowMove(the clickOn, topV, topH, 1)
  106.     set currCount to currCount + 1
  107.     if currCount = maxCnt then
  108.       set done to 1
  109.     else
  110.       set done to 0
  111.     end if
  112.     updateStage()
  113.     exit
  114.   else
  115.     set inPlace to 0
  116.     set the locV of sprite the clickOn to topIntV
  117.     set the locH of sprite the clickOn to topIntH
  118.     puppetSound("Cartoon Boing 2")
  119.     updateStage()
  120.   end if
  121. end
  122.  
  123. on button whereToGo, startSp, endSp, trueOrFalse
  124.   set spriteNum to the clickOn
  125.   set castName to the name of cast the castNum of sprite spriteNum
  126.   set the castNum of sprite spriteNum to the number of cast (castName & "Dn")
  127.   puppetSound("Click")
  128.   updateStage()
  129.   repeat while the mouseDown
  130.     if rollOver(spriteNum) then
  131.       set the castNum of sprite spriteNum to the number of cast (castName & "Dn")
  132.     else
  133.       set the castNum of sprite spriteNum to the number of cast castName
  134.     end if
  135.     updateStage()
  136.   end repeat
  137.   set the castNum of sprite spriteNum to the number of cast castName
  138.   updateStage()
  139.   CheckSound()
  140.   makePuppet(startSp, endSp, trueOrFalse)
  141.   if whereToGo = EMPTY then
  142.     exit
  143.   end if
  144.   go(whereToGo)
  145. end
  146.  
  147. on CheckSound
  148.   repeat while soundBusy(1)
  149.     nothing()
  150.   end repeat
  151.   puppetSound(0)
  152. end
  153.