home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Beams.dxr / 00154_Main.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  7.4 KB  |  116 lines

  1. property pMissionObjective, pTimeLimit, pStartTime, pFinalTimer
  2. global gLevelNum, gBlockArray, gLaserArray, gColorArray, gDirectionArray, gLaserList, gNumBlocks, gLockedArray, gRemaindingTime, gLevelSeconds
  3.  
  4. on new me
  5.   pFinalTimer = the ticks
  6.   gLevelSeconds = 0
  7.   repeat with superCounter = 15 to 580
  8.     sprite(superCounter).puppet = 0
  9.   end repeat
  10.   gLaserList = []
  11.   put count(gLaserList)
  12.   gNumBlocks = 0
  13.   gLevelNum = gLevelNum + 1
  14.   loadLevelData(gLevelNum)
  15.   diplayCurrentLevel()
  16.   count = 1
  17.   repeat with y = 1 to 8
  18.     repeat with x = 1 to 8
  19.       if gBlockArray[x][y] = 0 then
  20.         sprite(50 + count).puppet = 0
  21.       else
  22.         if gBlockArray[x][y] = 7 then
  23.           if gColorArray[x][y] = 3 then
  24.             append(gLaserList, new(script("LaserScript"), x, y, gDirectionArray[x][y], 1, (count(gLaserList) * 40) + 120))
  25.             append(gLaserList, new(script("LaserScript"), x, y, gDirectionArray[x][y], 2, (count(gLaserList) * 40) + 120))
  26.             append(gLaserList, new(script("LaserScript"), x, y, gDirectionArray[x][y], 4, (count(gLaserList) * 40) + 120))
  27.           else
  28.             append(gLaserList, new(script("LaserScript"), x, y, gDirectionArray[x][y], gColorArray[x][y], (count(gLaserList) * 40) + 120))
  29.           end if
  30.         end if
  31.         gBlockArray[x][y] = new(script("BlockScript"), y, x, gBlockArray[x][y], gColorArray[x][y], gDirectionArray[x][y], gLockedArray[x][y], 50 + count)
  32.         gNumBlocks = gNumBlocks + 1
  33.       end if
  34.       count = count + 1
  35.     end repeat
  36.   end repeat
  37.   repeat with a = 1 to count(gLaserList)
  38.     gLaserList[a].updateLaser()
  39.   end repeat
  40.   pStartTime = the ticks
  41. end
  42.  
  43. on exitFrame me
  44.   if pMissionObjective = 0 then
  45.     if (pFinalTimer + 60) < the ticks then
  46.       pFinalTimer = the ticks
  47.       gLevelSeconds = (the ticks - pStartTime) / 60
  48.       gRemaindingTime = pTimeLimit - gLevelSeconds
  49.       displayTime()
  50.     end if
  51.     if gRemaindingTime <= 0 then
  52.       puppetSound(4, "lose")
  53.       go(50)
  54.       exit
  55.     end if
  56.     doMouseInput()
  57.   end if
  58.   if ((keyPressed(SPACE) = 1) or (the mouseDown = 1)) and (sprite(599).visible = 1) then
  59.     pStartTime = the ticks
  60.     pMissionObjective = 0
  61.     sprite(599).visible = 0
  62.   end if
  63.   go(the frame)
  64. end
  65.  
  66. on loadLevelData levelNum
  67.   pMissionObjective = 1
  68.   case levelNum of
  69.     1:
  70.       sprite(599).visible = 1
  71.       sprite(599).member = "Hint1"
  72.       pTimeLimit = 240
  73.       gBlockArray = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [7, 0, 0, 0, 1, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [8, 0, 3, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
  74.       gColorArray = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 4, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
  75.       gDirectionArray = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 2, 2, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 2, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  76.       gLockedArray = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  77.     2:
  78.       sprite(599).visible = 1
  79.       sprite(599).member = "Hint2"
  80.       pTimeLimit = 200
  81.       gBlockArray = [[6, 6, 6, 6, 6, 6, 6, 6], [6, 6, 6, 6, 6, 6, 6, 6], [1, 6, 6, 6, 6, 6, 6, 6], [1, 6, 6, 6, 9, 6, 7, 6], [1, 6, 6, 6, 6, 6, 6, 6], [6, 6, 6, 6, 6, 6, 6, 6], [0, 8, 6, 6, 6, 6, 6, 6], [0, 0, 6, 6, 6, 6, 6, 6]]
  82.       gColorArray = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 3, 0, 3, 0], [3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
  83.       gDirectionArray = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 2, 1, 4, 1], [2, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  84.       gLockedArray = [[1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  85.     3:
  86.       sprite(599).visible = 1
  87.       sprite(599).member = "Hint3"
  88.       pTimeLimit = 180
  89.       gBlockArray = [[6, 6, 6, 8, 8, 6, 6, 6], [6, 6, 6, 4, 4, 6, 6, 6], [7, 2, 6, 0, 0, 6, 6, 6], [6, 6, 6, 1, 1, 6, 6, 6], [6, 6, 6, 1, 1, 6, 6, 6], [6, 6, 6, 6, 6, 6, 6, 6], [6, 6, 6, 6, 6, 6, 2, 1], [7, 6, 6, 9, 9, 6, 6, 8]]
  90.       gColorArray = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0], [3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 4], [3, 0, 0, 1, 2, 0, 0, 0]]
  91.       gDirectionArray = [[1, 1, 1, 3, 3, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 2, 2, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 2], [2, 1, 1, 1, 1, 1, 1, 1]]
  92.       gLockedArray = [[1, 1, 1, 0, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1], [0, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 1, 0, 0, 1, 1, 0]]
  93.     4:
  94.       sprite(599).visible = 1
  95.       sprite(599).member = "Hint4"
  96.       pTimeLimit = 180
  97.       gBlockArray = [[7, 0, 0, 0, 7, 0, 0, 7], [0, 7, 6, 6, 6, 6, 7, 0], [0, 6, 0, 0, 0, 3, 6, 0], [7, 6, 0, 3, 4, 0, 6, 0], [0, 6, 0, 4, 3, 0, 6, 7], [0, 6, 3, 0, 0, 0, 6, 0], [0, 7, 6, 6, 6, 6, 7, 0], [7, 0, 0, 7, 0, 0, 0, 7]]
  98.       gColorArray = [[2, 0, 0, 0, 4, 0, 0, 2], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 3, 0, 0], [4, 0, 0, 3, 1, 0, 0, 0], [0, 0, 0, 4, 3, 0, 0, 4], [0, 0, 3, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [2, 0, 0, 4, 0, 0, 0, 2]]
  99.       gDirectionArray = [[3, 1, 1, 1, 4, 1, 1, 4], [1, 3, 1, 1, 1, 1, 4, 1], [1, 1, 1, 1, 1, 1, 1, 1], [3, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 1, 1], [2, 1, 1, 2, 1, 1, 1, 1]]
  100.       gLockedArray = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 0, 0, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 0, 1, 1, 1, 0, 1], [1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  101.     5:
  102.       sprite(599).visible = 1
  103.       sprite(599).member = "Hint5"
  104.       pTimeLimit = 180
  105.       gBlockArray = [[0, 6, 6, 6, 6, 6, 6, 6], [0, 6, 1, 1, 1, 1, 1, 1], [0, 6, 1, 1, 1, 1, 3, 1], [0, 6, 1, 1, 1, 1, 1, 1], [7, 6, 1, 1, 1, 1, 3, 1], [7, 6, 1, 1, 1, 1, 1, 1], [7, 6, 1, 1, 1, 1, 3, 1], [0, 6, 6, 6, 6, 6, 6, 6]]
  106.       gColorArray = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 2, 2, 1, 2, 1], [0, 0, 4, 4, 4, 4, 4, 4], [0, 0, 1, 1, 1, 2, 2, 2], [2, 0, 1, 1, 4, 1, 2, 4], [1, 0, 4, 4, 1, 4, 1, 1], [4, 0, 2, 2, 2, 1, 1, 2], [0, 0, 0, 0, 0, 0, 0, 0]]
  107.       gDirectionArray = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]]
  108.       gLockedArray = [[1, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0]]
  109.   end case
  110.   pStartTime = the ticks
  111.   gLevelSeconds = 0
  112.   gLevelSeconds = (the ticks - pStartTime) / 60
  113.   gRemaindingTime = pTimeLimit - gLevelSeconds
  114.   displayTime()
  115. end
  116.