A 2D particle system with wide range of customizability.
The Particles instance can contain multiple ParticleGroup
instances - each of which works independently from one another.
To simplify designing of the particles HIDE contains a dedicated 2D particle editor and
stores the particle data in a JSON format, which then can be loaded with the Particles.load
method:
var part = new h2d.Particles();
part.load(haxe.Json.parse(hxd.Res.my_parts_file.entry.getText()), hxd.Res.my_parts_file.entry.path);
Constructor
new(?parent:Object)
Create a new Particles instance.
Parameters:
parent | An optional parent |
---|
Methods
addGroup(?g:ParticleGroup, ?index:Int):Null<ParticleGroup>
Add new particle group to the Particles.
Parameters:
g | Particle group to add. If null, will create an empty ParticleGroup. Note that when passing existing group, it should be created with this Particles instanceas the constructor argument, otherwise it may lead to undefined behavior. |
---|---|
index | Optional insertion index at which the group should be inserted. |
Returns:
Added ParticleGroup instance.
inlinegetGroups():ArrayIterator<ParticleGroup>
Returns an Iterator of particle groups within Particles.
load(o:Dynamic, ?resourcePath:String):Void
Loads previously saved Particles settings.
Parameters:
o | The saved Particles settings. |
---|---|
resourcePath | An optional path of the configuration file. May be safely omitted. |
save():Dynamic
Saves Particles settings and returns an object that can be saved into a file and then loaded with a Particles.load
method.