home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / AstroBubble.dxr / 00016.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.9 KB  |  85 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 = 120
  4.   p_MaxParticles = 30
  5.   p_MaxFrames = 20
  6.   p_FrameDelay = 1
  7.   p_FrameTitle = "Bubble bg"
  8.   p_StartFade = 100
  9.   p_FadeIncrement = -5
  10.   p_InkType = 37
  11.   p_SpawnTimer = 0
  12.   p_RandomFlip = 0
  13.   p_RotatePic = 1
  14.   p_LockPic = 1
  15.   p_StartSize = point(6, 15)
  16.   p_ScaleRate = point(0.29999999999999999, 0.75)
  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, particleDataBG
  31.   particleDataBG = []
  32.   repeat with wEntry = 1 to p_MaxParticles
  33.     wSprite = p_StartSprite + wEntry - 1
  34.     add(particleDataBG, [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
  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 addParticleBG spawnPoint, SpawnRotate
  44.   global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleDataBG, p_lockParticles
  45.   if p_lockParticles = 1 then
  46.     validSlot = 0
  47.     repeat with wSlot = 1 to p_MaxParticles
  48.       if (validSlot = 0) and (particleDataBG[wSlot][1] = 0) then
  49.         validSlot = wSlot
  50.       end if
  51.     end repeat
  52.     if validSlot <> 0 then
  53.       particleDataBG[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 "BG Bubble_Small " & string(random(3))
  57.       set the blend of sprite wSprite to 100
  58.       sprite(wSprite).rotation = 0
  59.       sprite(wSprite).visible = 1
  60.       sprite(wSprite).locZ = 1
  61.     end if
  62.   end if
  63. end
  64.  
  65. on moveParticlesBG
  66.   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, particleDataBG
  67.   p_SpawnTimer = p_SpawnTimer + 1
  68.   if p_SpawnTimer > 36500 then
  69.     p_SpawnTimer = 1
  70.   end if
  71.   repeat with wEntry = 1 to p_MaxParticles
  72.     wSprite = p_StartSprite + wEntry - 1
  73.     if particleDataBG[wEntry][1] = 1 then
  74.       if particleDataBG[wEntry][4][1] > -20 then
  75.         moveXSpeed = 4 + (wEntry mod 3 * (wEntry mod 5))
  76.         particleDataBG[wEntry][4] = particleDataBG[wEntry][4] + point(0 - moveXSpeed, 0)
  77.         set the loc of sprite wSprite to particleDataBG[wEntry][4]
  78.       else
  79.         particleDataBG[wEntry][1] = 0
  80.       end if
  81.       next repeat
  82.     end if
  83.   end repeat
  84. end
  85.