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

  1. global bgOffset
  2.  
  3. on init_ParticleConstants
  4.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_lockParticles, p_LockPic, p_StartSize, p_ScaleRate, p_RotatePic
  5.   p_StartSprite = 300
  6.   p_MaxParticles = 15
  7.   p_MaxFrames = [20, 11, 7, 4]
  8.   p_FrameDelay = [1, 1, 1, 1]
  9.   p_FrameTitle = ["Blast", "SBlast", "tBlast", "Laser"]
  10.   p_StartFade = 100
  11.   p_FadeIncrement = 1
  12.   p_InkType = 37
  13.   p_SpawnTimer = 0
  14.   p_RandomFlip = 0
  15.   p_RotatePic = 1
  16.   p_LockPic = 0
  17.   p_StartSize = point(6, 15)
  18.   p_ScaleRate = point(0, 0)
  19.   if p_FrameDelay < 1 then
  20.     p_FrameDelay = 1
  21.   end if
  22.   if p_StartFade < 1 then
  23.     p_StartFade = 1
  24.   end if
  25.   if p_StartFade > 100 then
  26.     p_StartFade = 100
  27.   end if
  28.   p_lockParticles = 1
  29. end
  30.  
  31. on init_Particles
  32.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, particleData
  33.   particleData = []
  34.   repeat with wEntry = 1 to p_MaxParticles
  35.     wSprite = p_StartSprite + wEntry - 1
  36.     add(particleData, [0, 0, 0, point(0, 0)])
  37.     sprite(wSprite).visible = 0
  38.     puppetSprite(wSprite, 1)
  39.     set the member of sprite wSprite to p_FrameTitle[1] & " 1"
  40.     set the ink of sprite wSprite to p_InkType
  41.     set the loc of sprite wSprite to point(0, 0)
  42.     sprite(wSprite).locZ = 450
  43.   end repeat
  44. end
  45.  
  46. on addparticle spawnPoint, SpawnRotate, spawnType
  47.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleData, p_lockParticles
  48.   if p_lockParticles = 1 then
  49.     validSlot = 0
  50.     repeat with wSlot = 1 to p_MaxParticles
  51.       if (validSlot = 0) and (particleData[wSlot][1] = 0) then
  52.         validSlot = wSlot
  53.       end if
  54.     end repeat
  55.     if validSlot <> 0 then
  56.       particleData[validSlot] = [spawnType, 0, 0, spawnPoint]
  57.       wSprite = p_StartSprite + validSlot - 1
  58.       set the loc of sprite wSprite to spawnPoint + bgOffset
  59.       set the member of sprite wSprite to p_FrameTitle[spawnType] & " 1"
  60.       set the blend of sprite wSprite to p_StartFade
  61.       sprite(wSprite).rotation = SpawnRotate
  62.       sprite(wSprite).visible = 1
  63.     end if
  64.   end if
  65. end
  66.  
  67. on moveParticles
  68.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_LockPic, p_StartSize, p_ScaleRate, particleData, playerViewPoint
  69.   p_SpawnTimer = p_SpawnTimer + 1
  70.   if p_SpawnTimer > 36500 then
  71.     p_SpawnTimer = 1
  72.   end if
  73.   repeat with wEntry = 1 to p_MaxParticles
  74.     wSprite = p_StartSprite + wEntry - 1
  75.     if particleData[wEntry][1] <> 0 then
  76.       eType = particleData[wEntry][1]
  77.       if particleData[wEntry][3] <= 1 then
  78.         particleData[wEntry][3] = p_FrameDelay[eType]
  79.         particleData[wEntry][2] = particleData[wEntry][2] + 1
  80.         if particleData[wEntry][2] > p_MaxFrames[eType] then
  81.           particleData[wEntry][1] = 0
  82.           sprite(wSprite).visible = 0
  83.         else
  84.           if p_LockPic = 0 then
  85.             set the member of sprite wSprite to p_FrameTitle[eType] & " " & string(particleData[wEntry][2])
  86.           else
  87.             set the blend of sprite wSprite to p_StartFade + (p_FadeIncrement * particleData[wEntry][2])
  88.           end if
  89.         end if
  90.       else
  91.         particleData[wEntry][3] = particleData[wEntry][3] - 1
  92.       end if
  93.       set the loc of sprite wSprite to particleData[wEntry][4] - playerViewPoint + bgOffset
  94.       next repeat
  95.     end if
  96.   end repeat
  97. end
  98.