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

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