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

  1. on exitFrame me
  2.   global reloadRate, reloadTimer, bgOffset, deathState, meteorData, spawnDelay, playerData, playerSO, totalRocks, playerScore, droneData, maxDrones, droneSO, laserData, alienData, maxAliens, alienSO
  3.   reloadRate = 20 - integer(totalRocks / 3)
  4.   if reloadRate < 1 then
  5.     reloadRate = 1
  6.   end if
  7.   reloadTimer = reloadTimer + 1
  8.   if reloadTimer > reloadRate then
  9.     reloadTimer = 0
  10.     addDrone()
  11.   end if
  12.   runDrones()
  13.   runAliens()
  14.   runLasers()
  15.   if meteorData[1] = 0 then
  16.     if spawnDelay > 0 then
  17.       spawnDelay = spawnDelay - 1
  18.     else
  19.       spawnDelay = 30 + random(20)
  20.       case random(2) of
  21.         1:
  22.           spawnloc = point([0, 5800][random(2)], random(4400))
  23.         2:
  24.           spawnloc = point(random(5800), [0, 4400][random(2)])
  25.       end case
  26.       set the member of sprite 6 to "Asteroid" & string(random(3))
  27.       meteorData[1] = 1
  28.       meteorData[2] = spawnloc
  29.       modPoint = point(1, 1)
  30.       if random(2) = 1 then
  31.         modPoint[1] = -1
  32.       end if
  33.       if random(2) = 1 then
  34.         modPoint[2] = -1
  35.       end if
  36.       meteorData[3] = (point(random(5), random(5)) * modPoint) + (modPoint * 2)
  37.     end if
  38.   end if
  39.   if meteorData[1] = 1 then
  40.     meteorData[2] = meteorData[2] + meteorData[3]
  41.     meteorData[4] = meteorData[4] + 6
  42.     if meteorData[3][1] > 0 then
  43.       if meteorData[2][1] > 6000 then
  44.         meteorData[2][1] = -200
  45.       end if
  46.     else
  47.       if meteorData[2][1] < -200 then
  48.         meteorData[2][1] = 6000
  49.       end if
  50.     end if
  51.     if meteorData[3][2] > 0 then
  52.       if meteorData[2][2] > 4600 then
  53.         meteorData[2][2] = -200
  54.       end if
  55.     else
  56.       if meteorData[2][2] < -200 then
  57.         meteorData[2][2] = 4600
  58.       end if
  59.     end if
  60.   end if
  61.   if meteorData[1] = 1 then
  62.     meteorDist = findDistance(meteorData[2], playerData[2])
  63.     if meteorDist <= 250 then
  64.       meteorData[1] = 0
  65.       playerScore = playerScore + 100 + (totalRocks * 10)
  66.       totalRocks = totalRocks + 1
  67.       if (totalRocks mod 5) = 0 then
  68.         addAlien()
  69.       end if
  70.       playSound("collect asteroid SFX", 5)
  71.       member("Score Display").text = string(playerScore)
  72.     end if
  73.   end if
  74.   if meteorData[1] = 1 then
  75.     set the loc of sprite 6 to meteorData[2] / 10
  76.     sprite(6).rotation = meteorData[4]
  77.   else
  78.     set the loc of sprite 6 to point(-50, -50)
  79.   end if
  80.   bgOffset = the loc of sprite 1
  81.   targAim = (the mouseLoc - bgOffset) * 10
  82.   if deathState = 0 then
  83.     pLoc = playerData[2]
  84.     pAim = findAngle(pLoc, targAim)
  85.     pDist = findDistance(pLoc, targAim)
  86.     playerSpeed = 20
  87.     if pDist <= playerSpeed then
  88.     else
  89.       locY = integer(cos(pAim * PI / 180) * -playerSpeed)
  90.       locX = integer(sin(pAim * PI / 180) * playerSpeed)
  91.       playerData[2] = playerData[2] + point(locX, locY)
  92.     end if
  93.     destruct = 0
  94.     coreloc = playerData[2]
  95.     closestDist = 750
  96.     repeat with wScan = 1 to maxDrones
  97.       if droneData[wScan][1] = 1 then
  98.         dLoc = droneData[wScan][2]
  99.         dist = findDistance(coreloc, dLoc)
  100.         if dist < closestDist then
  101.           closestDist = dist
  102.         end if
  103.         if dist <= 75 then
  104.           wSprite = wScan + droneSO - 1
  105.           set the loc of sprite wSprite to point(-10, -10)
  106.           droneData[wScan][1] = 0
  107.           destruct = 1
  108.           set the member of sprite 5 to "Explosion"
  109.         end if
  110.       end if
  111.     end repeat
  112.     swarmVolume = 200 - (200 * closestDist / 750)
  113.     if swarmVolume < 0 then
  114.       swarmVolume = 0
  115.     end if
  116.     if swarmVolume > 200 then
  117.       swarmVolume = 200
  118.     end if
  119.     sound(2).volume = swarmVolume
  120.     coreloc = playerData[2]
  121.     repeat with wScan = 1 to count(laserData)
  122.       if laserData[wScan][1] = 1 then
  123.         dLoc = laserData[wScan][2]
  124.         dist = findDistance(coreloc, dLoc)
  125.         if dist <= 150 then
  126.           destruct = 1
  127.           set the member of sprite 5 to "Explosion"
  128.         end if
  129.       end if
  130.     end repeat
  131.     coreloc = playerData[2]
  132.     repeat with wScan = 1 to maxAliens
  133.       if alienData[wScan][1] = 1 then
  134.         dLoc = alienData[wScan][2]
  135.         dist = findDistance(coreloc, dLoc)
  136.         if dist <= 175 then
  137.           wSprite = wScan + alienSO - 1
  138.           set the loc of sprite wSprite to point(-10, -10)
  139.           alienData[wScan][1] = 0
  140.           destruct = 1
  141.           set the member of sprite 5 to "Explosion"
  142.         end if
  143.       end if
  144.     end repeat
  145.   end if
  146.   hitBorder = 0
  147.   if playerData[2][1] > 5700 then
  148.     hitBorder = 1
  149.   end if
  150.   if playerData[2][1] < 100 then
  151.     hitBorder = 1
  152.   end if
  153.   if playerData[2][2] > 4100 then
  154.     hitBorder = 1
  155.   end if
  156.   if playerData[2][2] < 100 then
  157.     hitBorder = 1
  158.   end if
  159.   if hitBorder = 1 then
  160.     destruct = 1
  161.     set the member of sprite 5 to "Explosion"
  162.   end if
  163.   if (destruct = 1) and (deathState = 0) then
  164.     playSound("Explode SFX", 3)
  165.     deathState = 1
  166.   end if
  167.   if deathState > 0 then
  168.     deathState = deathState + 1
  169.   end if
  170.   set the loc of sprite playerSO to (playerData[2] / 10) + bgOffset
  171.   sprite(playerSO).rotation = pAim + 180
  172.   if deathState < 60 then
  173.     go(the frame)
  174.   else
  175.     go(25)
  176.   end if
  177. end
  178.