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

  1. on exitFrame me
  2.   global inputString, playerLocData, playerSO, playerViewPoint, targetSO, enemyData, deathDelay, winDelay, playerInvincible, holdingShot, shotPower, releaseShot, mouseinput, playerLives, totalEnemies, playerlevel, simultaneousEnemies, enemyArmyleft
  3.   harvestInput()
  4.   playerViewPoint = point(0, 0)
  5.   wFrame = 1
  6.   if (playerLocData[2] mod 300) > 150 then
  7.     wFrame = 2
  8.   end if
  9.   set the loc of sprite targetSO to the mouseLoc
  10.   playerInvincible = 0
  11.   if playerLocData[1] = 1 then
  12.     targloc = the mouseLoc * 10
  13.     targloc[2] = 2000
  14.     selfLoc = point(playerLocData[2], 3650)
  15.     mAim = findAngle(selfLoc, targloc)
  16.     locX = sin(mAim * PI / 180) * 150
  17.     if (inputString[3] = 1) or (inputString[5] = 1) then
  18.       guarding = 1
  19.     end if
  20.     if (shotPower = 0) and (guarding = 1) then
  21.       set the member of sprite playerSO to "closedshell"
  22.       playerInvincible = 1
  23.       sprite(playerSO).rotation = 0
  24.       targloc[1] = playerLocData[2]
  25.     else
  26.       if abs(locX) > 25 then
  27.         if shotPower = 0 then
  28.           playerLocData[2] = playerLocData[2] + locX
  29.           if playerLocData[2] > 5600 then
  30.             playerLocData[2] = 5600
  31.           end if
  32.           if playerLocData[2] < 200 then
  33.             playerLocData[2] = 200
  34.           end if
  35.           if locX > 0 then
  36.             playerLocData[4] = #right
  37.           else
  38.             if locX < 0 then
  39.               playerLocData[4] = #left
  40.             end if
  41.           end if
  42.           sprite(playerSO).rotation = 0
  43.           case playerLocData[4] of
  44.             #right:
  45.               set the member of sprite playerSO to "Oyster_R" & string(wFrame)
  46.             #left:
  47.               set the member of sprite playerSO to "Oyster_L" & string(wFrame)
  48.           end case
  49.         else
  50.           case playerLocData[4] of
  51.             #left:
  52.               sprite(playerSO).rotation = 0 - 20 + (shotPower * 12)
  53.             #right:
  54.               sprite(playerSO).rotation = 0 + 20 - (shotPower * 12)
  55.           end case
  56.           case playerLocData[4] of
  57.             #right:
  58.               set the member of sprite playerSO to "Oyster_R" & string(wFrame + 2)
  59.             #left:
  60.               set the member of sprite playerSO to "Oyster_L" & string(wFrame + 2)
  61.           end case
  62.         end if
  63.         set the loc of sprite playerSO to point(playerLocData[2] / 10, 365)
  64.       else
  65.         set the member of sprite playerSO to "OysterFront"
  66.         sprite(playerSO).rotation = 0
  67.       end if
  68.     end if
  69.     if random(8) = 1 then
  70.       addparticle(point(playerLocData[2], 3650), 0, 1)
  71.     end if
  72.     if shotPower > 0 then
  73.       shotPower = shotPower - 1
  74.       if shotPower = 0 then
  75.       end if
  76.     else
  77.       if mouseinput = 1 then
  78.         shotPower = 5
  79.         launchBullet()
  80.       else
  81.       end if
  82.     end if
  83.     rendPlayerAsunder = 0
  84.     if playerLocData[1] = 1 then
  85.       pLoc = point(playerLocData[2], 3600)
  86.       repeat with wEnemy = 1 to count(enemyData)
  87.         if (rendPlayerAsunder = 0) and (enemyData[wEnemy][1] = 1) then
  88.           rendDist = findDistance(enemyData[wEnemy][3], pLoc)
  89.           if rendDist <= 200 then
  90.             rendPlayerAsunder = wEnemy
  91.           end if
  92.         end if
  93.       end repeat
  94.     end if
  95.     if (rendPlayerAsunder <> 0) and (playerInvincible = 0) then
  96.       playerLocData[1] = 0
  97.       deathDelay = 40
  98.       repeat with wEffect = 1 to 100
  99.         addparticle(pLoc, 0, 2)
  100.       end repeat
  101.       playerLives = playerLives - 1
  102.       if playerLives < 0 then
  103.         member("Lives Display").text = "0"
  104.       else
  105.         member("Lives Display").text = string(playerLives)
  106.       end if
  107.       playSound("Player Hit", 3)
  108.     end if
  109.   else
  110.     if deathDelay > 1 then
  111.       deathDelay = deathDelay - 1
  112.       set the loc of sprite playerSO to point(-50, -50)
  113.     else
  114.       if playerLives < 0 then
  115.         go(25)
  116.       else
  117.         if mouseinput = 1 then
  118.           playerLocData = [1, 2900, 0, #center]
  119.           deathDelay = deathDelay - 1
  120.           set the blend of sprite playerSO to 100
  121.         else
  122.           set the loc of sprite playerSO to point(290, 365)
  123.           set the blend of sprite playerSO to random(100)
  124.         end if
  125.       end if
  126.     end if
  127.   end if
  128.   if (totalEnemies < simultaneousEnemies) and (enemyArmyleft > 0) then
  129.     enemyArmyleft = enemyArmyleft - 1
  130.     eType = [1, 2, 3, random(3)][playerlevel]
  131.     xSpawn = [-500, 6300][random(2)]
  132.     ySpawn = random(1500)
  133.     addEnemy(eType, point(xSpawn, ySpawn), point(random(20) - 10, 5 - random(20)))
  134.   end if
  135.   moveEnemies()
  136.   moveBullets()
  137.   moveParticles()
  138.   if (totalEnemies + enemyArmyleft) <= 0 then
  139.     if winDelay > 0 then
  140.       winDelay = winDelay - 1
  141.       go(the frame)
  142.     else
  143.       if playerlevel < 4 then
  144.         playerlevel = playerlevel + 1
  145.         go(15)
  146.       else
  147.         go(20)
  148.       end if
  149.     end if
  150.   else
  151.     go(the frame)
  152.   end if
  153. end
  154.  
  155. on mouseDown
  156.   global mouseinput
  157.   mouseinput = 1
  158. end
  159.  
  160. on mouseUp
  161.   global mouseinput
  162.   mouseinput = 0
  163. end
  164.