–============================ Comets ========================================
local Particles = require(“lib_particle_candy”)
–local StatusText = display.newText( " ", _W/2, _H-20, native.systemFont, 12 )
–StatusText:setTextColor( 255,255,255 )
– COMETS
local CometB = display.newImageRect(“comet_blue.png”,64,256)
CometB.yReference = -110
CometB.blendMode = “add”
– CREATE EMITTERS (NAME, SCREENW, SCREENH, ROTATION, ISVISIBLE, LOOP)
Particles.CreateEmitter(“E2”, 0,0, 90, false, true)
– DEFINE PARTICLE TYPES
Particles.CreateParticleType (“TailBlue”,
{
imagePath = “tail_blue.png”,
imageWidth = 32,
imageHeight = 128,
velocityStart = 150,
autoOrientation = true,
killOutsideScreen = false,
lifeTime = 6000,
scaleStart = 0.5,
scaleVariation = 0.15,
scaleInSpeed = 3.0,
alphaStart = 0,
fadeInSpeed = 0.45,
fadeOutSpeed = -0.9,
fadeOutDelay = 1000,
} )
– FEED EMITTERS (EMITTER NAME, PARTICLE TYPE NAME, EMISSION RATE, DURATION, DELAY)
Particles.AttachParticleType(“E2”, “TailBlue”, 7, 99999, 0)
– TRIGGER THE EMITTERS
Particles.StartEmitter(“E2”)
function ResetComet(Comet)
Comet.x = math.random()*_W
Comet.y = -Comet.height
Comet.speed = 5 + math.random()*10
Comet.rotation = 120 + math.random()*120
Comet.xSpeed = math.cos(math.rad(Comet.rotation - 90)) * Comet.speed
Comet.ySpeed = math.sin(math.rad(Comet.rotation - 90)) * Comet.speed
end
ResetComet(CometB)
– MAIN LOOP
local function main( event )
– UPDATE PARTICLES
Particles.Update()
– MOVE COMET
if CometB.y > _H or CometB.x < 0 or CometB.x > _W then ResetComet(CometB) end
CometB.x = CometB.x + CometB.xSpeed
CometB.y = CometB.y + CometB.ySpeed
Particles.GetEmitter(“E2”).x = CometB.x
Particles.GetEmitter(“E2”).y = CometB.y
Particles.GetEmitter(“E2”).rotation = CometB.rotation-180
– DISPLAY PARTICLE COUNT
–StatusText.text = “PARTICLES:”…Particles.CountParticles()
end
–============================================================================
Above is the entire code I am working with.
I have a Runtime EnterFrame listener that is tied to the main() function above.
Now If I run Particles.Freeze() then the active Particle on screen is stopped but other particle continue to spawn (this is problem 2)
Problem 1. was the initial issue, where when I run the CleanUp() function there are occasionally still particle left over between screens.
Now I think Particle Candy is an excellent product, but its not very useful to me right now. [import]uid: 55144 topic_id: 11488 reply_id: 41829[/import]