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

  1. global particleSO, maxParticles, particle_RefList, particleData, playerViewpoint
  2.  
  3. on initializeParticlereference
  4.   particle_RefList = []
  5.   sequenceNamelist = ["Light Impact 1", "Light Impact 2", "Light Impact 3", "Light Impact 4"]
  6.   add(particle_RefList, [sequenceNamelist, 4, 0, 36, 25])
  7.   sequenceNamelist = ["TBlast 1", "TBlast 2", "TBlast 3", "TBlast 4", "TBlast 5", "TBlast 6", "TBlast 7", "TBlast 8", "TBlast 9", "TBlast 10", "TBlast 11", "TBlast 12", "TBlast 12", "TBlast 13"]
  8.   add(particle_RefList, [sequenceNamelist, 7, 0, 36, 25])
  9.   sequenceNamelist = ["Sparkle 1", "Sparkle 2", "Sparkle 3"]
  10.   add(particle_RefList, [sequenceNamelist, 3, 0, 36, 25])
  11.   sequenceNamelist = ["SBlast 1", "SBlast 2", "SBlast 3", "SBlast 4", "SBlast 5", "SBlast 6", "SBlast 7", "SBlast 8", "SBlast 9", "SBlast 10", "SBlast 11"]
  12.   add(particle_RefList, [sequenceNamelist, 11, 0, 33, 12])
  13.   sequenceNamelist = ["Blast 1", "Blast 2", "Blast 3", "Blast 4", "Blast 5", "Blast 6", "Blast 7", "Blast 8", "Blast 9", "Blast 10", "Blast 11", "Blast 12", "Blast 13"]
  14.   add(particle_RefList, [sequenceNamelist, 11, 0, 33, 25])
  15.   sequenceNamelist = ["LowPoints 1"]
  16.   add(particle_RefList, [sequenceNamelist, 1, 30, 36, 25])
  17.   sequenceNamelist = ["HighPoints 1"]
  18.   add(particle_RefList, [sequenceNamelist, 1, 30, 36, 25])
  19. end
  20.  
  21. on initializeParticles
  22.   playerViewpoint = point(0, 0)
  23.   particleData = []
  24.   repeat with wPart = 1 to maxParticles
  25.     wSprite = particleSO + wPart
  26.     puppetSprite(wSprite, 1)
  27.     set the loc of sprite wSprite to point(-50, 50)
  28.     set the ink of sprite wSprite to 36
  29.     add(particleData, [0, 0, point(0, 0), point(0, 0), 0, 0])
  30.   end repeat
  31. end
  32.  
  33. on addparticle spawnType, spawnLoc, spawnMomentum
  34.   validSlot = 0
  35.   repeat with wSlot = 1 to maxParticles
  36.     if (validSlot = 0) and (particleData[wSlot][1] = 0) then
  37.       validSlot = wSlot
  38.     end if
  39.   end repeat
  40.   if validSlot <> 0 then
  41.     if spawnType = 11 then
  42.       spawnMomentum = point(0, 0)
  43.     end if
  44.     particleData[validSlot] = [1, spawnType, spawnLoc, spawnMomentum, 1, 0]
  45.     wSprite = particleSO + validSlot
  46.     set the member of sprite wSprite to particle_RefList[spawnType][1][1]
  47.     set the loc of sprite wSprite to (spawnLoc - playerViewpoint) / 10
  48.     set the ink of sprite wSprite to particle_RefList[spawnType][4]
  49.     sprite(wSprite).locZ = particle_RefList[spawnType][5]
  50.     sprite(wSprite).flipH = random(2) - 1
  51.     sprite(wSprite).flipV = random(2) - 1
  52.   end if
  53. end
  54.  
  55. on moveParticles
  56.   repeat with wSlot = 1 to maxParticles
  57.     if particleData[wSlot][1] = 1 then
  58.       wSprite = particleSO + wSlot
  59.       pType = particleData[wSlot][2]
  60.       frameNames = particle_RefList[pType][1]
  61.       maxFrames = particle_RefList[pType][2]
  62.       maxDelay = particle_RefList[pType][3]
  63.       canDraw = 0
  64.       if findDistance(playerViewpoint + point(2900, 2200), particleData[wSlot][3]) <= 3800 then
  65.         canDraw = 1
  66.       end if
  67.       particleData[wSlot][6] = particleData[wSlot][6] + 1
  68.       termination = 0
  69.       if particleData[wSlot][6] > maxDelay then
  70.         particleData[wSlot][5] = particleData[wSlot][5] + 1
  71.         particleData[wSlot][6] = 0
  72.         if particleData[wSlot][5] > maxFrames then
  73.           termination = 1
  74.         else
  75.           if canDraw = 1 then
  76.             set the member of sprite wSprite to frameNames[particleData[wSlot][5]]
  77.           end if
  78.         end if
  79.       end if
  80.       if termination = 1 then
  81.         set the loc of sprite wSprite to point(-50, 50)
  82.         particleData[wSlot][1] = 0
  83.         next repeat
  84.       end if
  85.       particleData[wSlot][3] = particleData[wSlot][3] + particleData[wSlot][4]
  86.       if canDraw = 1 then
  87.         set the loc of sprite wSprite to (particleData[wSlot][3] - playerViewpoint) / 10
  88.       end if
  89.     end if
  90.   end repeat
  91. end
  92.