home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TroyReturns.dxr / 00015.ls < prev    next >
Encoding:
Text File  |  2002-01-31  |  3.9 KB  |  97 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 = 350
  6.   p_MaxParticles = 8
  7.   p_MaxFrames = [11, 11, 7, 6, 10, 4, 4, 1]
  8.   p_FrameDelay = [1, 1, 1, 1, 3, 1, 1, 1]
  9.   p_FrameTitle = ["Blast", "SBlast", "tBlast", #Specific, #Specific, "Gold Sparkle", "Angry Flash", "Bubble"]
  10.   p_StartFade = [100, 100, 100, 70, 70, 100, 100, 100]
  11.   p_FadeIncrement = [0, 0, 0, -10, -5, 0, 0, 0]
  12.   p_InkType = [33, 33, 33, 36, 36, 36, 39, 33]
  13.   p_SpawnTimer = 0
  14.   p_RandomFlip = 0
  15.   p_RotatePic = 1
  16.   p_LockPic = [0, 0, 0, 1, 1, 0, 0, 0]
  17.   p_StartSize = point(6, 15)
  18.   p_ScaleRate = point(0, 0)
  19.   p_lockParticles = 1
  20. end
  21.  
  22. on init_Particles
  23.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, particleData
  24.   particleData = []
  25.   repeat with wEntry = 1 to p_MaxParticles
  26.     wSprite = p_StartSprite + wEntry - 1
  27.     add(particleData, [0, 0, 0, point(0, 0)])
  28.     sprite(wSprite).visible = 0
  29.     puppetSprite(wSprite, 1)
  30.     set the member of sprite wSprite to p_FrameTitle[1] & " 1"
  31.     set the loc of sprite wSprite to point(0, 0)
  32.     sprite(wSprite).locZ = 450
  33.   end repeat
  34. end
  35.  
  36. on addparticle spawnPoint, SpawnRotate, spawnType, membernm, memberFlip
  37.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleData, p_lockParticles
  38.   if p_lockParticles = 1 then
  39.     validSlot = 0
  40.     repeat with wSlot = 1 to p_MaxParticles
  41.       if (validSlot = 0) and (particleData[wSlot][1] = 0) then
  42.         validSlot = wSlot
  43.       end if
  44.     end repeat
  45.     if validSlot <> 0 then
  46.       particleData[validSlot] = [spawnType, 0, 0, spawnPoint]
  47.       wSprite = p_StartSprite + validSlot - 1
  48.       set the loc of sprite wSprite to spawnPoint + bgOffset
  49.       if membernm.ilk = #string then
  50.         set the member of sprite wSprite to p_FrameTitle[spawnType] & " 1"
  51.       else
  52.         set the member of sprite wSprite to membernm
  53.         sprite(wSprite).flipH = memberFlip
  54.       end if
  55.       set the blend of sprite wSprite to p_StartFade[spawnType]
  56.       sprite(wSprite).rotation = SpawnRotate
  57.       set the ink of sprite wSprite to p_InkType[spawnType]
  58.       sprite(wSprite).visible = 1
  59.     end if
  60.   end if
  61. end
  62.  
  63. on moveParticles
  64.   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, rumbleOffset
  65.   p_SpawnTimer = p_SpawnTimer + 1
  66.   if p_SpawnTimer > 36500 then
  67.     p_SpawnTimer = 1
  68.   end if
  69.   repeat with wEntry = 1 to p_MaxParticles
  70.     wSprite = p_StartSprite + wEntry - 1
  71.     if particleData[wEntry][1] <> 0 then
  72.       eType = particleData[wEntry][1]
  73.       if particleData[wEntry][3] <= 1 then
  74.         particleData[wEntry][3] = p_FrameDelay[eType]
  75.         particleData[wEntry][2] = particleData[wEntry][2] + 1
  76.         if particleData[wEntry][2] > p_MaxFrames[eType] then
  77.           particleData[wEntry][1] = 0
  78.           sprite(wSprite).visible = 0
  79.           set the loc of sprite wSprite to point(-50, -50)
  80.         else
  81.           if p_LockPic[eType] = 0 then
  82.             if p_FrameTitle[eType] <> #Specific then
  83.               set the member of sprite wSprite to p_FrameTitle[eType] & " " & string(particleData[wEntry][2])
  84.             end if
  85.           else
  86.             set the blend of sprite wSprite to p_StartFade[eType] + (p_FadeIncrement[eType] * particleData[wEntry][2])
  87.           end if
  88.         end if
  89.       else
  90.         particleData[wEntry][3] = particleData[wEntry][3] - 1
  91.       end if
  92.       set the loc of sprite wSprite to particleData[wEntry][4] - playerViewpoint + rumbleOffset
  93.       next repeat
  94.     end if
  95.   end repeat
  96. end
  97.