I don’t know… I recommend to use a simple implementation first.
Instead of a “black box”-module you should learn the principles, then you can go on implementing 3rd party stuff. but maybe it’s just my way of learning – as JayantV wrote: you decide.
however, take my example, but instead of using an onTouch event,
use an enterFrame loop:
-- THE EXPLOSION FUNCTION
local particles = {} -- particle table
local function explosion (theX, theY, blood) -- blood is BOOL
local particleCount = 3 -- number of particles per explosion
for i = 1, particleCount do
local theParticle = {}
theParticle.object = display.newRect(theX,theY,3,3)
if blood == true then
theParticle.object:setFillColor(250,0,0)
end
theParticle.xMove = math.random (10) - 5
theParticle.yMove = math.random (5) \* - 1
theParticle.gravity = 0.5
table.insert(particles, theParticle)
end
end
-- PARTICLES MOVING
function animation ()
for i,val in pairs(particles) do
-- move each particle
val.yMove = val.yMove + val.gravity
val.object.x = val.object.x + val.xMove
val.object.y = val.object.y + val.yMove
-- remove particles that are out of bound
if val.object.y \> display.contentHeight or val.object.x \> display.contentWidth or val.object.x \< 0 then
val.object:removeSelf();
particles [i] = nil
end
end
end
-- NO TOUCH! enter frame!
function emitter ()
local rndX = math.random (display.contentWidth)
explosion (rndX, -100)
end
Runtime:addEventListener( "enterFrame", animation)
Runtime:addEventListener( "enterFrame", emitter )
you should tweak the animation function to make it look like rain. right now it looks quite chaotic because the effect is based on explosions…
-finefin [import]uid: 70635 topic_id: 17093 reply_id: 64263[/import]