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

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