Particular Particles v2.1.2 - Randomizer and export of particle effects

Particular Particle is written by @stavrogin and edited by @briarfox

Get Particular Particle Here!

Particular Particles is a particle system editor that saves and exports particle effects.

  1. Include Particular Particle in your project.

  2. Save any particle effects from within Particular Particle.

  3. Click on the SavedOutput tab and copy the generated particle class and paste into your project tab.

-Note you can change the Texture here.

--Example Saved Particle
Example = class(Particular)
	Example.settings = {}
		Example.settings.img = "SpaceCute:Planet" --Set Texture Here
		Example.settings.partPerSec = 67
		Example.settings.sizeX = 203
		Example.settings.sizeY = 199
		Example.settings.life = 70
		Example.settings.lifeVariation = 93
		Example.settings.initPartSize = 1
		Example.settings.partSizeVariation = 54
		Example.settings.finalPartSize = 36
		Example.settings.velocity = 38.8692
		Example.settings.velocityVariation = 37
		Example.settings.rotSpd = 0.0806016
		Example.settings.rotSpdVariation = 67
		Example.settings.initOpacity = 164
		Example.settings.opacityVariation = 63
		Example.settings.finalOpacity = 213
		Example.settings.windX = -48
		Example.settings.airResistance = 0.541878
		Example.settings.gravity = -3.6593
		Example.settings.useGravityVector = 0
		Example.settings.sizeWiggle = 1
		Example.settings.turbulencePosAffect = 0
function Example:init(x,y)
	Particular.init(self,x,y,Example.settings)
end
--Example


  1. To create a particle in your project:
function setup()

example = Example(WIDTH/2,HEIGHT/2)

end

function draw()
example:draw()

end

–Reserved for revisions–

If there is enough interest I’ll keep working on this. I would like to add a pause and reset in the future.

Very cool, well done! I can see this being very useful. You could go a step further with the saved output and save it to a class inheriting from Particular.


Example = class(Particular)

Example.settings = {}

function Example:init(x,y,strSprite)
       Particular.init(self,x,y,strSprite,Example.settings)
end


Great idea! I’ll do that tonight.

@Briarfox - I think you break the record for the number of object properties :wink:

thanks!

@ignatz, I just added 3 :slight_smile:

you better watch out, I think Codea has a limit of 4,096

@Briarfox, this is awesome! You may, however, want to check the inputted particle name for illegal characters (like spaces). That’s if you want to make it idiot-proof. For instance, I used “Space Debris” as the name of my first saved particle. It saved fine, but it gave me an error when I tried to run it again–it didn’t like the space between the two words. I guess you could also just warn people.

@Ric_Esrey good point, I’ll add in a check. Glad you like it. I found it while digging through the forums. A few tweeks really make it useable!

Particular Particle has been updated. SavedOutput now outputs classes.

example = Example(x,y)

example:draw()

Small update.

The Texture image is now saved in output. You can change the texture in the SaveOutput tab.

I apologize to anyone who has already implemented a previous version. The init no longer passes a texture string.

To manually change the texture on the fly do:

e = Example(x,y)
e.particularMesh.texture = Your Texture

@Briarfox, I’m having a problem with the new version. When I load a particle parameter set and then save it again, I receive an error. It says, Error: … 379: Attempt to concatenate field ‘texture’ (a userdata value). Is this a bug or user error?

@Ric_Esrey Did you try deleting all the saved particles from SavedOutput?

This issue is with readImage() in SavedOutput. I added readImage() to make texture selection easier. However this converts the spritekey which breaks if you reload it. To keep any previous saves remove readImage() in SavedOutput but leave the spritekey string.

edit: Svae/Load has been fixed.

@Briarfox, It works great now. Thanks for the fast fix.

This is awesome. Thanks for sharing. I hackd in hacked in uv offsets.
First I added in the init

self.u = u or 0

self.v = v or 0

self.width = width

self.height = height

Right after every line:

 self.particularMesh:setRect(i,p.x,p.y,size,size,p.angle)

Then I add:

 self.particularMesh:SetRectTex(1,self.u,self.v,self.width,self.height)

Now I can use an atlas map for the images in the particles.

@Briarfox - this looks really cool - so what am I doing wrong?

I have it loaded and I run it, and I get all the parameters at left, nothing on the screen. If I choose Random, the screen flashes occasionally. If I set Draw_Emitters to 1, I get a blue dot on the screen, but nothing else.

I presume I’m supposed to be seeing a preview of how it will look, but for some reason, that’s not happening. Any suggestions? (It’s interesting that when I flick between full screen and parameter view, I glimpse the particle effect briefly!).

Also, it’s not clear to the first timer (ie me) what happens after you output a result. I presume you need to copy that class, plus the Particular tab, to your own project, then create instances of your class (the only difference between them being x,y position) and just draw them. That process works, when I try it (and I do see the effect on screen), so I think I answered my own question.

@Thwapp I’m not following you, can you post a video of the result?

@Ignatz I have no idea why it wouldn’t be working correctly. Can you try installing it again? To use the particle include Particular Particle as a library. Then copy and saved particles from SavedOutput into a tab in your project. Then create an instance of your particle and add its draw to draw()

I just pulled the project and it’s running. Not sure why you have an issue with displaying.

@Ignatz, the blue dot on the screen, when Draw_Emitters is set to 1, is correct behavior. I presume it’s telling you where the particles are starting from. However, the fact that no particles show up is strange. Do you think there’s a problem with your textures? For instance, in the Function PresetSmoke(), the texture assigned is: emitter.ParticleMesh.Texture = “Cargo Bot:Smoke Particle”. If your Cargo Bot graphics are bad, you wouldn’t see the preview.

@Ignatz Do any of the other presets work?