home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / RoboticInvaders.dxr / 00006.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  5.2 KB  |  185 lines

  1. global activeBullets, playerShipSO, playerData
  2.  
  3. on exitFrame me
  4.   global inputString, totalBugs, deathDelay, playerlevel, bossShipData, pBulletData, totalScore, playerScore, lowestRank, playerintro, victoryDelay, pBulletSO, swoopDelay, targetLocationList, selectedCraftList, homein, enemyData, swooperType, fadeTricky, playerLives, accuracyRating
  5.   harvestInput()
  6.   case playerlevel of
  7.     4:
  8.       swoopDelay = swoopDelay - 1
  9.     5:
  10.       swoopDelay = swoopDelay - 2
  11.   end case
  12.   if (deathDelay <> 40) or (playerintro <> 0) then
  13.     swoopDelay = 100
  14.   end if
  15.   if swoopDelay <= 0 then
  16.     targetLocationList = point(random(500) + 40, 0)
  17.     validCraftList = []
  18.     repeat with wEnemy = 1 to count(enemyData)
  19.       if enemyData[wEnemy][1] = 1 then
  20.         if enemyData[wEnemy][2] = swooperType then
  21.           if enemyData[wEnemy][6] = 0 then
  22.             add(validCraftList, wEnemy)
  23.           end if
  24.         end if
  25.       end if
  26.     end repeat
  27.     if count(validCraftList) >= 3 then
  28.       repeat with wAssignment = 1 to 3
  29.         rEntry = random(count(validCraftList))
  30.         enemyData[validCraftList[rEntry]][6] = 1
  31.         enemyData[validCraftList[rEntry]][7] = wAssignment
  32.         deleteAt(validCraftList, rEntry)
  33.       end repeat
  34.     end if
  35.     swoopDelay = 200
  36.   end if
  37.   if targetLocationList <> #Na then
  38.     targetLocationList[2] = targetLocationList[2] + 5
  39.   end if
  40.   if targetLocationList <> #Na then
  41.     if targetLocationList[2] > 400 then
  42.       recallSwoopRobots(1)
  43.       targetLocationList = #Na
  44.     end if
  45.   end if
  46.   runBugs()
  47.   runPBullets()
  48.   runEBullets()
  49.   updateArmors()
  50.   moveParticles()
  51.   if bossShipData[1] = 1 then
  52.     if bossShipData[2] > 0 then
  53.       bossShipData[2] = bossShipData[2] - 1
  54.       if bossShipData[2] = 1 then
  55.         playSound("Flyby Man SFX", 2)
  56.       end if
  57.     else
  58.       bossShipData[3] = bossShipData[3] + point(3, 0)
  59.       if fadeTricky > 5 then
  60.         addparticle(bossShipData[3], 0, 5)
  61.         fadeTricky = 0
  62.       else
  63.         fadeTricky = fadeTricky + 1
  64.       end if
  65.       repeat with wBullet = 1 to count(pBulletData)
  66.         if pBulletData[wBullet][1] = 1 then
  67.           if findDistance(bossShipData[3], pBulletData[wBullet][2]) <= 30 then
  68.             repeat with wEffect = 1 to 6
  69.               rBit = point(random(50), random(50)) - 25
  70.               addparticle(bossShipData[3] + rBit, 0, random(2))
  71.             end repeat
  72.             accuracyRating[1] = accuracyRating[1] + 1
  73.             pBulletData[wBullet][1] = 0
  74.             bossShipData[1] = 0
  75.             playerScore = playerScore + 500
  76.             member("Score display").text = string(totalScore + playerScore)
  77.             set the loc of sprite (pBulletSO + wBullet - 1) to point(-50, -50)
  78.           end if
  79.         end if
  80.       end repeat
  81.       set the loc of sprite 9 to bossShipData[3]
  82.     end if
  83.   else
  84.     set the loc of sprite 9 to point(-50, -50)
  85.   end if
  86.   if playerData[1] = 1 then
  87.     if playerintro > 0 then
  88.       set the loc of sprite playerShipSO to playerData[2] + point(0, playerintro)
  89.       playerintro = playerintro - 2
  90.     else
  91.       if inputString[1] = 1 then
  92.         playerData[2][1] = playerData[2][1] - 4
  93.       else
  94.         if inputString[2] = 1 then
  95.           playerData[2][1] = playerData[2][1] + 4
  96.         end if
  97.       end if
  98.       if playerData[2][1] <= 20 then
  99.         playerData[2][1] = 20
  100.       end if
  101.       if playerData[2][1] >= 560 then
  102.         playerData[2][1] = 560
  103.       end if
  104.       set the loc of sprite playerShipSO to playerData[2]
  105.     end if
  106.     sprite(playerShipSO).visible = 1
  107.   else
  108.     addparticle(playerData[2] + point(random(30), random(30)) - 15, 0, random(2) + 1)
  109.     deathDelay = deathDelay - 1
  110.     sprite(playerShipSO).visible = 0
  111.   end if
  112.   if playerintro = 0 then
  113.     if inputString[5] = 1 then
  114.       if playerData[1] = 1 then
  115.         if activeBullets < 1 then
  116.           addBullet(playerData[2], 14, 0)
  117.           accuracyRating[2] = accuracyRating[2] + 1
  118.         end if
  119.       end if
  120.     end if
  121.   end if
  122.   if lowestRank >= 340 then
  123.     playerData[1] = 0
  124.     playerLives = 0
  125.   end if
  126.   if (playerData[1] = 0) and (deathDelay <= 0) then
  127.     if playerLives > 0 then
  128.       deathDelay = 40
  129.       playerLives = playerLives - 1
  130.       initializeplayer()
  131.       playerintro = 100
  132.       if playerLives < 0 then
  133.         go(the frame)
  134.       else
  135.         member("Lives display").text = string(playerLives)
  136.         go(the frame)
  137.       end if
  138.     else
  139.       if deathDelay <= 0 then
  140.         go(35)
  141.       else
  142.         deathDelay = deathDelay - 1
  143.         go(the frame)
  144.       end if
  145.     end if
  146.   else
  147.     if totalBugs = 0 then
  148.       if playerlevel = 5 then
  149.         go(30)
  150.       else
  151.         if victoryDelay <= 0 then
  152.           go(25)
  153.         else
  154.           victoryDelay = victoryDelay - 1
  155.           go(the frame)
  156.         end if
  157.       end if
  158.     else
  159.       go(the frame)
  160.     end if
  161.   end if
  162. end
  163.  
  164. on recallSwoopRobots wSwooping
  165.   global enemyData
  166.   repeat with wRobot = 1 to count(enemyData)
  167.     if enemyData[wRobot][6] = wSwooping then
  168.       enemyData[wRobot][6] = 0
  169.       enemyData[wRobot][7] = 0
  170.     end if
  171.   end repeat
  172. end
  173.  
  174. on mouseDown
  175.   global accuracyRating, playerintro
  176.   if playerintro = 0 then
  177.     if playerData[1] = 1 then
  178.       if activeBullets < 1 then
  179.         addBullet(playerData[2], 14, 0)
  180.         accuracyRating[2] = accuracyRating[2] + 1
  181.       end if
  182.     end if
  183.   end if
  184. end
  185.