Particle Loaders (ssk.pex.*)
This module allows you to load and directly create Corona emitters using any of these particle source formats/tools:
- Roaming Gamer Particle Editor 2 (.rg, .png) - A free tool that only requires SSK2 Pro to run.
- Particle Designer 2 (.json, .png) - With this paid Mac-only tool, you can export a JSON encoded table (emitter definition) and an image file (the particle used by the emitter).
- Starling (.pex, .png) - With this free browser tool, you can export an XML file (emitter definition) and an image file (the particle used by the emitter).
Loaders
All three loaders have a similar signature:
-- Roaming Gamer Particle Editor 2
local emitter = ssk.pex.loadRG( group, x, y, fileName [ , params ] )
--Particle Designer 2
local emitter = ssk.pex.loadPD2( group, x, y, fileName [ , params ] )
-- Starling
local emitter = ssk.pex.loadStarling( group, x, y, fileName [ , params ] )
All three loaders will load their respective definition file types and then call newEmitter() to create an emitter
vent. These parameters control how the emitter
is created.
group
(display.currentStage
) - Group to place emitter object in.x
,y
- < x, y > position to place emitter at.fileName
- Full path and name of emitter definition file.params
(nil
) - A paramaterized table of settings to further modify the emitter before creating it.texturePath
- An alternate path to the particle image you would like to use (path-only, not file name.)altTexture
- An alternate particle image to use.- Key-Value Parameters - You can override the value of any named parameter in the standard Key-Value Parameters list. This means you can create a particle definition file with an editor, but later modify specific parameters just before creating the emitter instance.
Example Loader Calls
-- ==========================================
-- 1. Particle Designer Format
-- ==========================================
local emitter1 = ssk.pex.loadPD2( nil, centerX - 200, centerY,
"emitters/ParticleDesigner2/Comet.json",
{ texturePath = "emitters/ParticleDesigner2/" } )
emitter1.rotation = 45
-- ==========================================
-- 2. Roaming Gamer Particle Editor (1 & 2)
-- ==========================================
local emitter2 = ssk.pex.loadRG( nil, centerX, centerY,
"emitters/RG/emitter16178.rg",
{ texturePath = "emitters/RG/",
altTexture = "particle78348.png" } )
-- ==========================================
-- 3. Starling Format
-- ==========================================
local emitter3 = ssk.pex.loadStarling( nil, centerX + 200, centerY,
"emitters/Starling/particle3.pex",
{ altTexture = "images/star.png" } )
Copyright © Roaming Gamer, LLC. 2008-2016; All Rights Reserved