home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Silhouette.dxr / 00001.ls next >
Encoding:
Text File  |  2002-01-25  |  6.5 KB  |  220 lines

  1. on translateSet horizontalA, horizontalB, verticalA, verticalB
  2.   finalTest = horizontalA + (horizontalB * 2) + (verticalA * 4) + (verticalB * 8)
  3.   memDat = [1, 7, 0]
  4.   memberType = "nothing"
  5.   case finalTest of
  6.     0:
  7.       memDat = [1, 6, 0]
  8.     1:
  9.       memDat = [1, 1, 0]
  10.     2:
  11.       memDat = [1, 1, 180]
  12.     3:
  13.       memDat = [1, 3, 90]
  14.     4:
  15.       memDat = [1, 1, 270]
  16.     5:
  17.       memDat = [1, 2, 0]
  18.     6:
  19.       memDat = [1, 2, 270]
  20.     7:
  21.       memDat = [1, 4, 270]
  22.     8:
  23.       memDat = [1, 1, 90]
  24.     9:
  25.       memDat = [1, 2, 90]
  26.     10:
  27.       memDat = [1, 2, 180]
  28.     11:
  29.       memDat = [1, 4, 90]
  30.     12:
  31.       memDat = [1, 3, 0]
  32.     13:
  33.       memDat = [1, 4, 0]
  34.     14:
  35.       memDat = [1, 4, 180]
  36.     15:
  37.       memDat = [1, 5, 0]
  38.     16:
  39.       memDat = [1, 5, 0]
  40.     30:
  41.       memDat = [1, 8, 0]
  42.     45:
  43.       memDat = [1, 9, 0]
  44.   end case
  45.   return memDat
  46. end
  47.  
  48. on testSolidity
  49.   global shadowShapeData, blankMapData, solidData, levelWidth
  50.   solidData = []
  51.   repeat with whichY = 1 to count(shadowShapeData)
  52.     oneLiner = []
  53.     repeat with whichX = 1 to levelWidth
  54.       add(oneLiner, 0)
  55.     end repeat
  56.     add(solidData, oneLiner.value)
  57.   end repeat
  58.   repeat with whichY = 1 to count(shadowShapeData)
  59.     repeat with whichX = 1 to levelWidth
  60.       if shadowShapeData[whichY][whichX] <> 0 then
  61.         solidData[whichY][whichX] = 1
  62.       end if
  63.     end repeat
  64.   end repeat
  65. end
  66.  
  67. on setBlock sType, sRotate
  68.   set the member of sprite 245 to "Shape " & string(sType)
  69.   sprite(245).rotation = sRotate * 90
  70. end
  71.  
  72. on simulateGravity
  73.   global shadowShapeData, shadowSpinData, blankMapData, solidData, rippleData, levelWidth, tileSize, shadowSolidData
  74.   wSprite = 10
  75.   repeat with whichY = 1 to count(shadowShapeData)
  76.     repeat with whichX = 1 to levelWidth
  77.       if rippleData[whichY][whichX] > 0 then
  78.         rippleData[whichY][whichX] = rippleData[whichY][whichX] - 10
  79.         if rippleData[whichY][whichX] < 0 then
  80.           rippleData[whichY][whichX] = 0
  81.         end if
  82.         rBit = rippleData[whichY][whichX]
  83.         set the loc of sprite wSprite to point(whichX * tileSize, (whichY * tileSize) - rBit) + the loc of sprite 2 - (tileSize / 2)
  84.       else
  85.         set the loc of sprite wSprite to point(whichX * tileSize, whichY * tileSize) + the loc of sprite 2 - (tileSize / 2)
  86.       end if
  87.       if whichY <= (count(shadowShapeData) - 1) then
  88.         if solidData[whichY][whichX] <> 0 then
  89.           if solidData[whichY + 1][whichX] = 0 then
  90.             recMod = [0, 0, 0, 0]
  91.             recMod[1] = shadowShapeData[whichY][whichX]
  92.             recMod[2] = shadowSpinData[whichY][whichX]
  93.             recMod[3] = shadowSolidData[whichY][whichX]
  94.             shadowShapeData[whichY][whichX] = 0
  95.             shadowSpinData[whichY][whichX] = 0
  96.             shadowSolidData[whichY][whichX] = 0
  97.             shadowShapeData[whichY + 1][whichX] = recMod[1]
  98.             shadowSpinData[whichY + 1][whichX] = recMod[2]
  99.             shadowSolidData[whichY + 1][whichX] = recMod[3]
  100.             rippleData[whichY + 1][whichX] = rippleData[whichY][whichX] + tileSize
  101.             rippleData[whichY][whichX] = 0
  102.             solidData[whichY][whichX] = 0
  103.             solidData[whichY + 1][whichX] = 1
  104.           end if
  105.         end if
  106.       end if
  107.       wSprite = wSprite + 1
  108.     end repeat
  109.   end repeat
  110. end
  111.  
  112. on addToQue
  113.   global maxShapeList, playerlevel, stampShapeQue, stampSpinQue
  114.   newStamp = random(3 + playerlevel)
  115.   add(stampShapeQue, newStamp)
  116.   add(stampSpinQue, 1)
  117. end
  118.  
  119. on scanLevelComplete
  120.   global shadowShapeData, shadowSpinData, shadowSolidData, blankMapData, solidData, levelWidth, checkSafe, playerlevel, playerScore, levelScore
  121.   ghostDetected = 0
  122.   repeat with yScan = 1 to count(shadowSolidData)
  123.     repeat with xScan = 1 to count(shadowSolidData[1])
  124.       if shadowSolidData[yScan][xScan] = 1 then
  125.         ghostDetected = 1
  126.       end if
  127.     end repeat
  128.   end repeat
  129.   if ghostDetected = 0 then
  130.     playerlevel = playerlevel + 1
  131.     member("Level Display").text = string(playerlevel)
  132.     if playerlevel = 4 then
  133.       go(20)
  134.     else
  135.       playSound("Added Blocks SFX", 1)
  136.       repeat with yScan = 1 to count(shadowSolidData)
  137.         repeat with xScan = 1 to count(shadowSolidData[1])
  138.           if (yScan > 1) and (yScan <= (playerlevel + 1)) then
  139.             if shadowShapeData[yScan][xScan] = 0 then
  140.               shadowSolidData[yScan][xScan] = 1
  141.               shadowShapeData[yScan][xScan] = 3 + random(playerlevel)
  142.               shadowSpinData[yScan][xScan] = random(4)
  143.             end if
  144.           end if
  145.         end repeat
  146.       end repeat
  147.       updateShadowDisplay()
  148.     end if
  149.   end if
  150. end
  151.  
  152. on scanLevelCompleteDefunct
  153.   global shadowShapeData, shadowSpinData, shadowSolidData, blankMapData, solidData, levelWidth, checkSafe, playerlevel, playerScore, levelScore
  154.   vTestAData = blankMapData
  155.   totalScores = 0
  156.   tileShapeOne = shadowShapeData[8][1]
  157.   tileSpinOne = shadowSpinData[8][1]
  158.   checkSafe = 1
  159.   if (tileShapeOne <> 0) and (tileSpinOne <> 0) then
  160.     repeat with whichX = 2 to levelWidth
  161.       whichY = 8
  162.       if (shadowShapeData[whichY][whichX] <> tileShapeOne) or (shadowSpinData[whichY][whichX] <> tileSpinOne) then
  163.         checkSafe = 0
  164.       end if
  165.     end repeat
  166.   else
  167.     checkSafe = 0
  168.   end if
  169.   if checkSafe = 1 then
  170.     repeat with whichX = 1 to levelWidth
  171.       whichY = 8
  172.       shadowShapeData[whichY][whichX] = 0
  173.       shadowSpinData[whichY][whichX] = 0
  174.     end repeat
  175.     spareBlocks = 0
  176.     repeat with xS = 1 to count(shadowShapeData[1])
  177.       repeat with yS = 1 to count(shadowShapeData)
  178.         if shadowShapeData[yS][xS] <> 0 then
  179.           spareBlocks = spareBlocks + 1
  180.         end if
  181.       end repeat
  182.     end repeat
  183.     maxShapeList = 5 + playerlevel
  184.     if maxShapeList > 8 then
  185.       maxShapeList = 8
  186.     end if
  187.     levelScore = 500 + (playerlevel * 500) - (spareBlocks * 50)
  188.     playerScore = playerScore + levelScore
  189.     if playerlevel < 5 then
  190.       go(15)
  191.     else
  192.       go(20)
  193.     end if
  194.   else
  195.     spareBlocks = 0
  196.     repeat with xS = 1 to count(shadowShapeData[1])
  197.       repeat with yS = 1 to count(shadowShapeData)
  198.         if shadowShapeData[yS][xS] <> 0 then
  199.           spareBlocks = spareBlocks + 1
  200.         end if
  201.       end repeat
  202.     end repeat
  203.     member("Blocks Display").text = string(spareBlocks)
  204.     member("Score Display").text = string(playerScore)
  205.   end if
  206. end
  207.  
  208. on playSound whichSound, whichSlot
  209.   global lastClear
  210.   if whichSlot = 2 then
  211.     sound(2).stop()
  212.     sound(2).queue([#member: member(whichSound)])
  213.     sound(2).play()
  214.   else
  215.     sound(1).stop()
  216.     sound(1).queue([#member: member(whichSound)])
  217.     sound(1).play()
  218.   end if
  219. end
  220.