home *** CD-ROM | disk | FTP | other *** search
- on addDebris spawnloc
- global debrisData, riverWidth, riverOffset
- validSlot = 0
- repeat with whichSlot = 1 to count(debrisData)
- if (debrisData[whichSlot][1] = 0) and (validSlot = 0) then
- validSlot = whichSlot
- end if
- end repeat
- if validSlot <> 0 then
- checkEdges = 0
- if checkEdges = 1 then
- xLoc = riverWidth
- if random(2) = 1 then
- xLoc = 1
- end if
- else
- xLoc = random(riverWidth)
- end if
- debrisData[validSlot] = [1, point(xLoc, -500)]
- theSprite = 34 + validSlot
- set the member of sprite theSprite to "Obstacle " & random(5)
- end if
- end
-
- on moveDebris
- global debrisData, scrollingSpeed, riverOffset, flagPosition, riverWidth
- repeat with whichItem = 1 to count(debrisData)
- theSprite = 34 + whichItem
- if debrisData[whichItem][1] = 1 then
- debrisData[whichItem][2] = debrisData[whichItem][2] + point(0, scrollingSpeed * 10)
- if debrisData[whichItem][2][2] > 5000 then
- debrisData[whichItem][1] = 0
- set the loc of sprite theSprite to point(-50, -50)
- next repeat
- end if
- drawloc = debrisData[whichItem][2]
- depthRatio = (debrisData[whichItem][2][2] + 8000) / 10000.0
- centerPoint = (riverWidth / 20) + riverOffset
- centerDrift = (drawloc[1] - (riverWidth / 2)) * depthRatio / 13
- set the loc of sprite theSprite to point(centerPoint + centerDrift, integer(drawloc[2] / 10))
- end if
- end repeat
- flagPosition = flagPosition + (scrollingSpeed * 10)
- if flagPosition > 6000 then
- set the locV of sprite 70 to -50
- sprite(70).locZ = 999
- else
- drawloc = flagPosition / 10
- set the locV of sprite 70 to integer(drawloc)
- sprite(70).locZ = 999
- end if
- end
-