Particles creator plugin

Does anyone know of a plugin for the Effekseer particle creator for Solar2D - there are many for various game engines and frameworks (I even saw one for ‘Love’). It would be very much appreciated.

Here is link for create particle effect for Solar2D.

Thank You very much !!!

:star_struck:

That’s incredible what it is possible to do with this tool :+1:

The tool export this kind of data

{
"startColorAlpha": 1,
"startParticleSizeVariance": 10,
"startColorGreen": 0.8,
"rotatePerSecond": 0,
"radialAcceleration": 303,
"yCoordFlipped": -1,
"emitterType": 0,
"blendFuncSource": 770 ,
"finishColorVarianceAlpha": 0,
"rotationEnd": 0,
"startColorVarianceBlue": 0.2,
"rotatePerSecondVariance": 0,
"particleLifespan": 1.1,
"minRadius": 0,
"configName": "fire",
"tangentialAcceleration": -7,
"rotationStart": -60,
"startColorVarianceGreen": 0,
"speed": 1000,
"minRadiusVariance": 0,
"finishColorVarianceBlue": 0,
"finishColorBlue": 0,
"finishColorGreen": 0,
"blendFuncDestination": 1,
"finishColorAlpha": 1,
"sourcePositionVariancex": 0,
"startParticleSize": 131,
"sourcePositionVariancey": 0,
"startColorRed": 1,
"finishColorVarianceRed": 0,
"textureFileName": "particle_texture.png",
"startColorVarianceAlpha": 0.2,
"maxParticles": 421,
"finishColorVarianceGreen": 0,
"finishParticleSize": 40,
"duration": 0.26,
"startColorVarianceRed": 0,
"finishColorRed": 0,
"gravityx": -11,
"maxRadiusVariance": 0,
"finishParticleSizeVariance": 0,
"gravityy": 2000,
"rotationEndVariance": 0,
"startColorBlue": 0.4,
"rotationStartVariance": 1065,
"speedVariance": 750,
"radialAccelVariance": 0,
"textureImageData": "",
"tangentialAccelVariance": 0,
"particleLifespanVariance": 0.4,
"angleVariance": 180,
"angle": -91,
"maxRadius": 0
}

How to convert that into solar2D values ?

Oups.
Sorry. It seem’s that exactly the table given to newEmitter !

Thanks for pointing that out - I thought it was still in Json format.

But can you please give me the necessary Lua code?
I’m using “display.newEmitter(particle_texture)” but get nothing displayed (no errors either).

Much appreciated.

The emitter requires a Lua table with all required parameters.
The most common issue I have seen is the path to the texture; you’ll need to adjust the value of ‘textureFileName’ if the texture file name and/or path don’t match.

More details on that here:

Thanks 'Siu;. I still couldn’t get it to work, but after much trial and error I finally got it to work.
In case someone else doesn’t know how to do it, this is what I did:-

I went to website “EffectHub Cocos2dx Particle Effect Editor” and clicked on “Export” then “CoronaSDK” to download “particle_texture.json”. You need to also click on “particle_texture.png” (next to it) to download the .png as well.

Then the Lua code you need to execute this particle effect is as follows:-

local filePath = system.pathForFile( “particle_texture.json” )
local f = io.open( filePath, “r” )
local emitterData = f:read( “*a” )
f:close()

emitterParams = json.decode( emitterData )

emitter = display.newEmitter( emitterParams )

– Center the emitter within the content area
emitter.x = display.contentCenterX
emitter.y = display.contentCenterY

Took me quite a while to figure it all out.

I’m very new to Solar2d and know very little - but I like it!

Hope this helps somebody not in the know.

1 Like

Here is link for Solar2d samples emitter viewer from github.You can also find this from your Solar2d simulator.Just open Solar2d simulator and you can see left bottom corner button name “Samples”.

Here is a simple class for creating emitters easily.

local particleDesigner = {}

local json = require "json"

particleDesigner.loadParams = function( filename, baseDir, textureSubDir )

	baseDir = baseDir or system.ResourceDirectory

	-- load file
	local path = system.pathForFile( filename, baseDir )

	local f = io.open( path, 'r' )

	local data = f:read( "*a" )
	f:close()

	-- convert json to Lua table
	local params = json.decode( data )

	if textureSubDir then
		-- Append the subdirectory to the texture file name if supplied
		params.textureFileName = textureSubDir .. params.textureFileName
	end

	return params
end

----------------------------------------------------------------------
-- New Emitter
--
-- Returns a new emitter objects
--   filename = particle data file name (with subdirectory appended)
--   baseDir = base directory for both particle data file and texture file (optional but must be nil if textureSubDir used)
--   textureSubDir = subdirectory for texture file (optional)
--
particleDesigner.newEmitter = function( filename, baseDir, textureSubDir )

	local emitterParams = particleDesigner.loadParams( filename, baseDir, textureSubDir )

	local emitter = display.newEmitter( emitterParams, baseDir )	-- for new version of "newEmitter" API

	return emitter
end

return particleDesigner

Then you can load an emitter like this

local emitter = particleDesigner.newEmitter( "myEmitter.json" )
2 Likes