home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / RowsAndColumns.dxr / 00002.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  5.9 KB  |  193 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 verticalAData, verticalBData, horizontalAData, horizontalBData, blankMapData, solidData, levelWidth
  50.   solidData = []
  51.   repeat with whichY = 1 to 10
  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 10
  59.     repeat with whichX = 1 to levelWidth
  60.       if verticalAData[whichY][whichX] = 1 then
  61.         solidData[whichY][whichX] = 1
  62.         next repeat
  63.       end if
  64.       if verticalBData[whichY][whichX] = 1 then
  65.         solidData[whichY][whichX] = 1
  66.         next repeat
  67.       end if
  68.       if horizontalAData[whichY][whichX] = 1 then
  69.         solidData[whichY][whichX] = 1
  70.         next repeat
  71.       end if
  72.       if horizontalBData[whichY][whichX] = 1 then
  73.         solidData[whichY][whichX] = 1
  74.       end if
  75.     end repeat
  76.   end repeat
  77. end
  78.  
  79. on setBlock h1, h2, v1, v2
  80.   sprite(4).visible = h1
  81.   sprite(5).visible = h2
  82.   sprite(6).visible = v1
  83.   sprite(7).visible = v2
  84. end
  85.  
  86. on simulateGravity
  87.   global verticalAData, verticalBData, horizontalAData, horizontalBData, blankMapData, solidData, rippleData, levelWidth
  88.   wSprite = 10
  89.   repeat with whichY = 1 to 10
  90.     repeat with whichX = 1 to levelWidth
  91.       if rippleData[whichY][whichX] > 0 then
  92.         rippleData[whichY][whichX] = rippleData[whichY][whichX] - 10
  93.         if rippleData[whichY][whichX] < 0 then
  94.           rippleData[whichY][whichX] = 0
  95.         end if
  96.         rBit = rippleData[whichY][whichX]
  97.         set the loc of sprite wSprite to point(whichX * 40, (whichY * 40) - rBit) + the loc of sprite 2 - 20
  98.       else
  99.         set the loc of sprite wSprite to point(whichX * 40, whichY * 40) + the loc of sprite 2 - 20
  100.       end if
  101.       if whichY <= 9 then
  102.         if solidData[whichY][whichX] <> 0 then
  103.           if solidData[whichY + 1][whichX] = 0 then
  104.             recMod = [0, 0, 0, 0]
  105.             recMod[1] = verticalAData[whichY][whichX]
  106.             recMod[2] = verticalBData[whichY][whichX]
  107.             recMod[3] = horizontalAData[whichY][whichX]
  108.             recMod[4] = horizontalBData[whichY][whichX]
  109.             verticalAData[whichY][whichX] = 0
  110.             verticalBData[whichY][whichX] = 0
  111.             horizontalAData[whichY][whichX] = 0
  112.             horizontalBData[whichY][whichX] = 0
  113.             verticalAData[whichY + 1][whichX] = recMod[1]
  114.             verticalBData[whichY + 1][whichX] = recMod[2]
  115.             horizontalAData[whichY + 1][whichX] = recMod[3]
  116.             horizontalBData[whichY + 1][whichX] = recMod[4]
  117.             rippleData[whichY + 1][whichX] = rippleData[whichY][whichX] + 40
  118.             rippleData[whichY][whichX] = 0
  119.             solidData[whichY][whichX] = 0
  120.             solidData[whichY + 1][whichX] = 1
  121.           end if
  122.         end if
  123.       end if
  124.       wSprite = wSprite + 1
  125.     end repeat
  126.   end repeat
  127. end
  128.  
  129. on scanConnections
  130.   global verticalAData, verticalBData, horizontalAData, horizontalBData, blankMapData, solidData, levelWidth, playerScore
  131.   vTestAData = blankMapData
  132.   totalScores = 0
  133.   repeat with whichX = 1 to levelWidth
  134.     repeat with whichY = 1 to 8
  135.       if verticalAData[whichY][whichX] = 1 then
  136.         if verticalAData[whichY + 1][whichX] = 1 then
  137.           if verticalAData[whichY + 2][whichX] = 1 then
  138.             verticalAData[whichY][whichX] = 0
  139.             verticalAData[whichY + 1][whichX] = 0
  140.             verticalAData[whichY + 2][whichX] = 0
  141.             totalScores = totalScores + 1
  142.           end if
  143.         end if
  144.       end if
  145.       if verticalBData[whichY][whichX] = 1 then
  146.         if verticalBData[whichY + 1][whichX] = 1 then
  147.           if verticalBData[whichY + 2][whichX] = 1 then
  148.             verticalBData[whichY][whichX] = 0
  149.             verticalBData[whichY + 1][whichX] = 0
  150.             verticalBData[whichY + 2][whichX] = 0
  151.             totalScores = totalScores + 1
  152.           end if
  153.         end if
  154.       end if
  155.     end repeat
  156.   end repeat
  157.   repeat with whichY = 1 to 10
  158.     repeat with whichX = 1 to levelWidth - 2
  159.       if horizontalAData[whichY][whichX] = 1 then
  160.         if horizontalAData[whichY][whichX + 1] = 1 then
  161.           if horizontalAData[whichY][whichX + 2] = 1 then
  162.             horizontalAData[whichY][whichX] = 0
  163.             horizontalAData[whichY][whichX + 1] = 0
  164.             horizontalAData[whichY][whichX + 2] = 0
  165.             totalScores = totalScores + 1
  166.           end if
  167.         end if
  168.       end if
  169.       if horizontalBData[whichY][whichX] = 1 then
  170.         if horizontalBData[whichY][whichX + 1] = 1 then
  171.           if horizontalBData[whichY][whichX + 2] = 1 then
  172.             horizontalBData[whichY][whichX] = 0
  173.             horizontalBData[whichY][whichX + 1] = 0
  174.             horizontalBData[whichY][whichX + 2] = 0
  175.             totalScores = totalScores + 1
  176.           end if
  177.         end if
  178.       end if
  179.     end repeat
  180.   end repeat
  181.   playerScore = playerScore + (totalScores * totalScores * 10)
  182.   if totalScores > 0 then
  183.     playSound("Dissapear", 2)
  184.   end if
  185.   put playerScore into member "Player Score"
  186. end
  187.  
  188. on playSound whichSound, whichSlot
  189.   sound(whichSlot).stop()
  190.   sound(whichSlot).queue([#member: member(whichSound)])
  191.   sound(whichSlot).play()
  192. end
  193.