home *** CD-ROM | disk | FTP | other *** search
- on init_ParticleConstants
- 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
- p_StartSprite = 310
- p_MaxParticles = 50
- p_MaxFrames = 5
- p_FrameDelay = 1
- p_FrameTitle = "Smoke"
- p_StartFade = 100
- p_FadeIncrement = -8
- p_InkType = 36
- p_SpawnTimer = 0
- p_RandomFlip = 0
- p_RotatePic = 1
- p_LockPic = 1
- p_StartSize = point(5, 10)
- p_ScaleRate = -point(0.5, 0.5)
- if p_FrameDelay < 1 then
- p_FrameDelay = 1
- end if
- if p_StartFade < 1 then
- p_StartFade = 1
- end if
- if p_StartFade > 100 then
- p_StartFade = 100
- end if
- p_lockParticles = 1
- end
-
- on init_Particles
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, particleData
- particleData = []
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- add(particleData, [0, 0, 0, point(0, 0)])
- sprite(wSprite).visible = 0
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to p_FrameTitle & " 1"
- set the ink of sprite wSprite to p_InkType
- set the loc of sprite wSprite to point(0, 0)
- end repeat
- end
-
- on addparticle spawnPoint, SpawnRotate
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleData, p_lockParticles
- if p_lockParticles = 1 then
- validSlot = 0
- repeat with wSlot = 1 to p_MaxParticles
- if (validSlot = 0) and (particleData[wSlot][1] = 0) then
- validSlot = wSlot
- end if
- end repeat
- if validSlot <> 0 then
- particleData[validSlot] = [1, 0, 0, spawnPoint]
- wSprite = p_StartSprite + validSlot - 1
- set the loc of sprite wSprite to spawnPoint
- set the member of sprite wSprite to p_FrameTitle & " 1"
- set the blend of sprite wSprite to p_StartFade
- sprite(wSprite).rotation = SpawnRotate
- sprite(wSprite).visible = 1
- end if
- end if
- end
-
- on moveParticles
- 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
- p_SpawnTimer = p_SpawnTimer + 1
- if p_SpawnTimer > 36500 then
- p_SpawnTimer = 1
- end if
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- if particleData[wEntry][1] = 1 then
- if particleData[wEntry][3] <= 1 then
- particleData[wEntry][3] = p_FrameDelay
- particleData[wEntry][2] = particleData[wEntry][2] + 1
- if particleData[wEntry][2] > p_MaxFrames then
- particleData[wEntry][1] = 0
- sprite(wSprite).visible = 0
- else
- if p_LockPic = 0 then
- set the member of sprite wSprite to p_FrameTitle & " " & string(particleData[wEntry][2])
- else
- set the width of sprite wSprite to p_StartSize[1] + (p_ScaleRate[1] * particleData[wEntry][2])
- set the height of sprite wSprite to p_StartSize[2] + (p_ScaleRate[2] * particleData[wEntry][2])
- set the blend of sprite wSprite to p_StartFade + (p_FadeIncrement * particleData[wEntry][2])
- end if
- end if
- else
- particleData[wEntry][3] = particleData[wEntry][3] - 1
- end if
- next repeat
- end if
- end repeat
- end
-