Skip to content

prasannakkcse/Custom-particle-emitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Use emitter.lua to create particles in corona SDK. Effects like smoke can be achieved using this package.

SAMPLE USAGE 1:

local emitter = require("emitter")
local PARTICLES_PER_BURST = 20
local emit1 = emitter.createEmitter(<radiusRange>, <thickness>,<particleDuration>, <initAlpha>, <endAlpha>)
emitter.setColor(emit1, <red>, <green>, <blue>)
 
for i = 1,PARTICLES_PER_BURST do
  emitter.emit(emit1, <group>, <x>, <y>) --emits single particle per call  
end     

SAMPLE USAGE 2: SMOKE

local emitter = require("emitter")
local mainGroup = display.newGroup()
local emit1
local PARTICLES_PER_BURST = 6
local i
local mem = display.newText("Memory :"..tostring(collectgarbage("count")), 0, 0, nil, 20)
 
local function init()
 
emit1 = emitter.createEmitter(180,  140,  1500, 0.05, 0)
emitter.setColor(emit1,255,255,0)
 
end
 
local function burst(event)
 
    for i = 1,PARTICLES_PER_BURST do
                emitter.emit(emit1, mainGroup, event.x, event.y)   
                
        end     
        
        mem.text = "Memory :"..tostring(collectgarbage("count"))
        
end
 
Runtime:addEventListener("touch", burst)
 
init()

About

Lua based Custom particle emitter for corona SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages