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

  1. on addDebris spawnloc
  2.   global debrisData, riverWidth, riverOffset
  3.   validSlot = 0
  4.   repeat with whichSlot = 1 to count(debrisData)
  5.     if (debrisData[whichSlot][1] = 0) and (validSlot = 0) then
  6.       validSlot = whichSlot
  7.     end if
  8.   end repeat
  9.   if validSlot <> 0 then
  10.     checkEdges = 0
  11.     if checkEdges = 1 then
  12.       xLoc = riverWidth
  13.       if random(2) = 1 then
  14.         xLoc = 1
  15.       end if
  16.     else
  17.       xLoc = random(riverWidth)
  18.     end if
  19.     debrisData[validSlot] = [1, point(xLoc, -500)]
  20.     theSprite = 34 + validSlot
  21.     set the member of sprite theSprite to "Obstacle " & random(5)
  22.   end if
  23. end
  24.  
  25. on moveDebris
  26.   global debrisData, scrollingSpeed, riverOffset, flagPosition, riverWidth
  27.   repeat with whichItem = 1 to count(debrisData)
  28.     theSprite = 34 + whichItem
  29.     if debrisData[whichItem][1] = 1 then
  30.       debrisData[whichItem][2] = debrisData[whichItem][2] + point(0, scrollingSpeed * 10)
  31.       if debrisData[whichItem][2][2] > 5000 then
  32.         debrisData[whichItem][1] = 0
  33.         set the loc of sprite theSprite to point(-50, -50)
  34.         next repeat
  35.       end if
  36.       drawloc = debrisData[whichItem][2]
  37.       depthRatio = (debrisData[whichItem][2][2] + 8000) / 10000.0
  38.       centerPoint = (riverWidth / 20) + riverOffset
  39.       centerDrift = (drawloc[1] - (riverWidth / 2)) * depthRatio / 13
  40.       set the loc of sprite theSprite to point(centerPoint + centerDrift, integer(drawloc[2] / 10))
  41.     end if
  42.   end repeat
  43.   flagPosition = flagPosition + (scrollingSpeed * 10)
  44.   if flagPosition > 6000 then
  45.     set the locV of sprite 70 to -50
  46.     sprite(70).locZ = 999
  47.   else
  48.     drawloc = flagPosition / 10
  49.     set the locV of sprite 70 to integer(drawloc)
  50.     sprite(70).locZ = 999
  51.   end if
  52. end
  53.