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

  1. global starfieldSO, maxStars, starDepth, starfieldData, playerViewPoint
  2.  
  3. on initializeStarField
  4.   starfieldData = []
  5.   repeat with wStar = 1 to maxStars
  6.     wSprite = starfieldSO + wStar
  7.     puppetSprite(wSprite, 1)
  8.     rDepth = random(40)
  9.     set the loc of sprite wSprite to point(random(580), random(440))
  10.     set the member of sprite wSprite to "star " & string(6 - (rDepth / 8))
  11.     set the ink of sprite wSprite to 33
  12.     sprite(wSprite).locZ = starDepth
  13.     add(starfieldData, [point(random(10000), random(10000)), rDepth])
  14.   end repeat
  15. end
  16.  
  17. on runStarField
  18.   repeat with wStar = 1 to count(starfieldData)
  19.     starloc = starfieldData[wStar][1] - (playerViewPoint * starfieldData[wStar][2] / 1000)
  20.     starloc[1] = starloc[1] mod 580
  21.     starloc[2] = starloc[2] mod 440
  22.     wSprite = starfieldSO + wStar
  23.     set the loc of sprite wSprite to starloc
  24.   end repeat
  25. end
  26.