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

  1. on exitFrame me
  2.   global riverWidth, debrisFrequency, debrisTimer, debrisData, ProgressData, playerData, riverOffset, scrollingSpeed, playerThrottle, playerAcel, playerPosition, sparkIntensity, flagChecks, roundTimer, vanishCheckpoint, inputString, scoreRecords, playerlevel, lapBonusPoints, spareTimeBonus, playerLevelScore, playerTotalScore, checkTimer, secondsTimer, flagPosition, driftLoc, splashData, splashCycle, splashRateDelay, frameTime, frameTally
  3.   debrisFrequency = [100, 75, 50][playerlevel]
  4.   harvestInput()
  5.   drawShore()
  6.   moveDebris()
  7.   sparkOn = 0
  8.   repeat with whichScan = 1 to count(debrisData)
  9.     if debrisData[whichScan][1] = 1 then
  10.       testDist1 = findDistance(debrisData[whichScan][2], playerData[2] + point(0, -200))
  11.       testDist2 = findDistance(debrisData[whichScan][2], playerData[2] + point(0, 200))
  12.       if (testDist1 <= 250) or (testDist2 <= 250) then
  13.         playerThrottle = playerThrottle / 10
  14.         midPoint = (debrisData[whichScan][2] + playerData[2]) / 2
  15.         set the loc of sprite 74 to (midPoint / 10) + point(riverOffset, 0)
  16.         sparkOn = 1
  17.         debrisData[whichScan][2][2] = 10000
  18.         playSound("Hit " & string(random(3)) & " SFX", 4)
  19.       end if
  20.     end if
  21.   end repeat
  22.   if (sparkOn = 1) and (sparkIntensity >= 5) then
  23.     sparkIntensity = 0
  24.     sprite(74).flipH = random(2) - 1
  25.     sprite(74).flipV = random(2) - 1
  26.   end if
  27.   if sparkIntensity < 5 then
  28.     sparkIntensity = sparkIntensity + 1
  29.     set the member of sprite 74 to "Splat A" & string(sparkIntensity)
  30.   else
  31.     set the loc of sprite 74 to point(-50, -50)
  32.   end if
  33.   if playerThrottle < 10 then
  34.     playerThrottle = 10
  35.   end if
  36.   if debrisTimer <= 0 then
  37.     debrisTimer = debrisTimer + debrisFrequency + random(debrisFrequency)
  38.     addDebris(random(riverWidth))
  39.   else
  40.     debrisTimer = debrisTimer - scrollingSpeed
  41.   end if
  42.   if playerThrottle < 150 then
  43.     if inputString[4] = 1 then
  44.       playerThrottle = playerThrottle + 2
  45.     end if
  46.   end if
  47.   if playerThrottle > 10 then
  48.     if inputString[3] = 1 then
  49.       playerThrottle = playerThrottle - 3
  50.     end if
  51.   end if
  52.   scrollingSpeed = playerThrottle / 10
  53.   sprite(71).rotation = (playerThrottle * 240 / 150) - 30 - integer((playerThrottle + 1) / 30)
  54.   set the locV of sprite 79 to -50
  55.   startPoints = 2000
  56.   incrementPoints = 1
  57.   checkTimer = checkTimer - 1
  58.   if checkTimer <= 0 then
  59.     checkTimer = checkTimer + 30
  60.     secondsTimer = secondsTimer - 1
  61.     setTimerFields = 1
  62.   else
  63.     setTimerFields = 0
  64.   end if
  65.   if flagChecks[1] = 0 then
  66.     roundTimer[1] = roundTimer[1] + 1
  67.     if playerPosition > 15000 then
  68.       playSound("Checkpoint SFX", 5)
  69.       flagChecks[1] = 1
  70.       set the member of sprite 80 to "Checkpoint Animation"
  71.       updateStage()
  72.       sprite(80).visible = 1
  73.       vanishCheckpoint = 50
  74.       put secondsTimer into member "Lap 1 score"
  75.       spareTimeBonus = spareTimeBonus + secondsTimer
  76.       secondsTimer = secondsTimer + 45
  77.       lapBonusPoints = 500
  78.       set the member of sprite 70 to "checkpoint Flag"
  79.       flagPosition = 0
  80.     end if
  81.     if setTimerFields = 1 then
  82.       put secondsTimer into member "Lap 1 score"
  83.     end if
  84.     scoreRecords[1] = scoreRecords[1] + 1
  85.   else
  86.     if flagChecks[2] = 0 then
  87.       roundTimer[2] = roundTimer[2] + 1
  88.       if playerPosition > 30000 then
  89.         playSound("Checkpoint SFX", 5)
  90.         flagChecks[2] = 1
  91.         set the member of sprite 80 to "Checkpoint Animation"
  92.         updateStage()
  93.         sprite(80).visible = 1
  94.         vanishCheckpoint = 50
  95.         put secondsTimer into member "Lap 2 score"
  96.         spareTimeBonus = spareTimeBonus + secondsTimer
  97.         secondsTimer = secondsTimer + 45
  98.         lapBonusPoints = 1000
  99.         set the member of sprite 70 to "checkpoint Flag"
  100.         flagPosition = 0
  101.       end if
  102.       if setTimerFields = 1 then
  103.         put secondsTimer into member "Lap 2 score"
  104.       end if
  105.       scoreRecords[2] = scoreRecords[2] + 1
  106.     else
  107.       if flagChecks[3] = 0 then
  108.         roundTimer[3] = roundTimer[3] + 1
  109.         if playerPosition > 45000 then
  110.           playSound("Checkpoint SFX", 5)
  111.           flagChecks[3] = 1
  112.           set the member of sprite 80 to "Checkpoint Animation"
  113.           updateStage()
  114.           sprite(80).visible = 1
  115.           vanishCheckpoint = 50
  116.           put secondsTimer into member "Lap 3 score"
  117.           spareTimeBonus = spareTimeBonus + secondsTimer
  118.           secondsTimer = secondsTimer + 45
  119.           lapBonusPoints = 1500
  120.           set the member of sprite 70 to "checkpoint Flag"
  121.           flagPosition = 0
  122.         end if
  123.         if setTimerFields = 1 then
  124.           put secondsTimer into member "Lap 3 score"
  125.         end if
  126.         scoreRecords[3] = scoreRecords[3] + 1
  127.       else
  128.         if flagChecks[4] = 0 then
  129.           roundTimer[4] = roundTimer[4] + 1
  130.           if playerPosition > 60000 then
  131.             playSound("Checkpoint SFX", 5)
  132.             flagChecks[4] = 1
  133.             set the member of sprite 80 to "Checkpoint Animation"
  134.             updateStage()
  135.             sprite(80).visible = 1
  136.             vanishCheckpoint = 50
  137.             put secondsTimer into member "Lap 4 score"
  138.             spareTimeBonus = spareTimeBonus + secondsTimer
  139.             lapBonusPoints = 2000
  140.             set the member of sprite 70 to "Finish Flag"
  141.             flagPosition = 0
  142.           end if
  143.           if setTimerFields = 1 then
  144.             put secondsTimer into member "Lap 4 score"
  145.           end if
  146.           scoreRecords[4] = scoreRecords[4] + 1
  147.         end if
  148.       end if
  149.     end if
  150.   end if
  151.   if playerPosition > 60500 then
  152.     if playerlevel = 3 then
  153.       playerLevelScore = lapBonusPoints + spareTimeBonus
  154.       go(20)
  155.     else
  156.       playerLevelScore = lapBonusPoints + spareTimeBonus
  157.       go(15)
  158.     end if
  159.   else
  160.     if secondsTimer <= 0 then
  161.       playerLevelScore = lapBonusPoints
  162.       go(25)
  163.     end if
  164.   end if
  165.   finalScore = playerTotalScore + lapBonusPoints + spareTimeBonus
  166.   if finalScore < 10 then
  167.     set the member of sprite 217 to "Digit empty"
  168.     set the member of sprite 218 to "Digit empty"
  169.     set the member of sprite 219 to "Digit empty"
  170.     set the member of sprite 220 to "Digit " & string(char 1 of string(finalScore))
  171.   else
  172.     if finalScore < 100 then
  173.       set the member of sprite 217 to "Digit empty"
  174.       set the member of sprite 218 to "Digit empty"
  175.       set the member of sprite 219 to "Digit " & string(char 1 of string(finalScore))
  176.       set the member of sprite 220 to "Digit " & string(char 2 of string(finalScore))
  177.     else
  178.       if finalScore < 1000 then
  179.         set the member of sprite 217 to "Digit empty"
  180.         set the member of sprite 218 to "Digit " & string(char 1 of string(finalScore))
  181.         set the member of sprite 219 to "Digit " & string(char 2 of string(finalScore))
  182.         set the member of sprite 220 to "Digit " & string(char 3 of string(finalScore))
  183.       else
  184.         if finalScore < 10000 then
  185.           set the member of sprite 217 to "Digit " & string(char 1 of string(finalScore))
  186.           set the member of sprite 218 to "Digit " & string(char 2 of string(finalScore))
  187.           set the member of sprite 219 to "Digit " & string(char 3 of string(finalScore))
  188.           set the member of sprite 220 to "Digit " & string(char 4 of string(finalScore))
  189.         end if
  190.       end if
  191.     end if
  192.   end if
  193.   if vanishCheckpoint > 0 then
  194.     vanishCheckpoint = vanishCheckpoint - 1
  195.     if vanishCheckpoint = 0 then
  196.       sprite(80).visible = 0
  197.       set the member of sprite 80 to "reddot"
  198.     end if
  199.   end if
  200.   if (playerPosition / 200) <= 300 then
  201.     set the loc of sprite 77 to point(468, 362 - (playerPosition / 200))
  202.   end if
  203.   shipLoc = playerData[2]
  204.   if inputString[1] = 1 then
  205.     driftLoc[1] = driftLoc[1] - 50
  206.   else
  207.     if inputString[2] = 1 then
  208.       driftLoc[1] = driftLoc[1] + 50
  209.     end if
  210.   end if
  211.   targloc = playerData[2] + driftLoc
  212.   if playerData[2][1] < 25 then
  213.     playerData[2][1] = 25
  214.     if playerThrottle > 0 then
  215.       playerThrottle = playerThrottle - 5
  216.       if playerThrottle < 0 then
  217.         playerThrottle = 0
  218.       end if
  219.     end if
  220.   else
  221.     if playerData[2][1] > (riverWidth - 25) then
  222.       playerData[2][1] = riverWidth - 25
  223.       if playerThrottle > 0 then
  224.         playerThrottle = playerThrottle - 5
  225.         if playerThrottle < 0 then
  226.           playerThrottle = 0
  227.         end if
  228.       end if
  229.     end if
  230.   end if
  231.   if playerData[2][2] < 500 then
  232.     playerData[2][2] = 500
  233.   else
  234.     if playerData[2][2] > 4000 then
  235.       playerData[2][2] = 4000
  236.     end if
  237.   end if
  238.   totalSpeed = findDistance(shipLoc, targloc)
  239.   playerMoveAim = findAngle(shipLoc, targloc)
  240.   totalSpeed = totalSpeed / 10
  241.   if totalSpeed > 120 then
  242.     totalSpeed = 120
  243.   end if
  244.   totalSpeed = integer(totalSpeed * scrollingSpeed / 5)
  245.   locY = cos(playerMoveAim * PI / 180) * -totalSpeed
  246.   locX = sin(playerMoveAim * PI / 180) * totalSpeed
  247.   dropSpeed = locY
  248.   playerData[2] = playerData[2] + point(locX, locY)
  249.   drawloc = playerData[2]
  250.   depthRatio = (playerData[2][2] + 2000) / 6000.0
  251.   centerPoint = (riverWidth / 20) + riverOffset
  252.   centerDrift = (drawloc[1] - (riverWidth / 2)) * depthRatio / 10
  253.   set the loc of sprite 87 to point(centerPoint + centerDrift, integer(drawloc[2] / 10))
  254.   sprite(87).rotation = locX / 10
  255.   shipAngle = locX / 10
  256.   if splashRateDelay <= 2 then
  257.     splashRateDelay = splashRateDelay + 1
  258.   else
  259.     splashRateDelay = splashRateDelay - 1
  260.     splashCycle = splashCycle + 1
  261.     if splashCycle > count(splashData) then
  262.       splashCycle = 1
  263.     end if
  264.     splashData[splashCycle][1] = 0
  265.     locY = cos(shipAngle * PI / 180) * -(-550)
  266.     locX = sin(shipAngle * PI / 180) * -550
  267.     splashData[splashCycle][2] = playerData[2] + point(locX, locY - 300)
  268.   end if
  269.   repeat with whichSplash = 1 to count(splashData)
  270.     if splashData[whichSplash][1] >= 20 then
  271.       set the loc of sprite (130 + whichSplash) to point(-50, -50)
  272.       next repeat
  273.     end if
  274.     splashData[whichSplash][2] = splashData[whichSplash][2] + (point(0, playerThrottle) / 2)
  275.     splashData[whichSplash][1] = splashData[whichSplash][1] + 1
  276.     set the member of sprite (130 + whichSplash) to "splash " & string(splashData[whichSplash][1] / 4)
  277.     sprite(130 + whichSplash).flipH = random(2) - 1
  278.     sprite(130 + whichSplash).locZ = 55 - splashData[whichSplash][1]
  279.     drawloc = splashData[whichSplash][2]
  280.     depthRatio = (splashData[whichSplash][2][2] + 3000) / 6000.0
  281.     centerPoint = (riverWidth / 20) + riverOffset
  282.     centerDrift = (drawloc[1] - (riverWidth / 2)) * depthRatio / 12
  283.     set the loc of sprite (130 + whichSplash) to point(centerPoint + centerDrift, integer(drawloc[2] / 10))
  284.   end repeat
  285.   frameTally = frameTally + 1
  286.   if frameTime < the ticks then
  287.     frameTally = 0
  288.     frameTime = the ticks + 30
  289.   end if
  290.   go(the frame)
  291. end
  292.