Assign_Emitter()
Syntax: _Assign_Emitter(ImageName, EmitterName, Emitter_Dx, Emitter_Dy, Emitter_Scale_X, Emitter_Scale_Y)
Purpose: Attaches a pre-created emitter to an image object, making the particles appear to originate from that image.
Parameters:
ImageName: The name of the image object (can use wildcards).
EmitterName: The name you assigned to the emitter when creating it.
Emitter_Dx, Emitter_Dy: (Optional) Offset values to adjust the emitter's position relative to the image's center.
(0, 0) is the image center.
(-0.5, -0.5) is the top-left corner.
Emitter_Scale_X, Emitter_Scale_Y: (Optional) Scaling factors to resize the effect.
Important: Only works with dynamic image objects.
Create_Emitter()
Syntax: _Create_Emitter(EmitterName, Emitter_Params, x, y, Emitter_baseDir, Forced_a)
Purpose: Creates a new particle emitter based on parameters defined in a JSON file.
Parameters:
EmitterName: A unique name to identify this emitter.
Emitter_Params: The path to the JSON file containing the emitter definition.
x, y: The initial coordinates of the emitter.
Emitter_baseDir: (Optional) Base directory for both particle data and textures.
Forced_a: (Optional) Restricts where this command is allowed to execute.
Get_Parameters()
Syntax: _Get_Parameters(filename)
Purpose: Reads a JSON file and parses it into a Lua table, giving you access to the data structure.
Parameters:
filename: The name of the JSON file (".json" extension is auto-added if not included).
Emitter Properties
Emitter properties (found in your JSON file) control the particles' appearance, behavior, and lifespan. Let's group them:
General Emitter Properties:
state: Indicates if the emitter is 'playing', 'stopped', etc.
textureFileName: Image used for the particles.
maxParticles: Limits the number of active particles.
angle, angleVariance: Emission direction and spread.
emitterType: 0 (point/line/field), or 1 (radial)
absolutePosition: Controls if particles move with the emitter.
duration: How long the emitter runs (-1 is infinite).
Point/Line/Field Properties:
speed, speedVariance: Particle launch speed.
sourcePositionVariancex, sourcePositionVariancey: Spread of the emission area.
gravityx, gravityy: Implied gravity affecting particles.
radialAcceleration, radialAccelVariance: Outward or inward acceleration.
tangentialAcceleration, tangentialAccelVariance: Circular acceleration.
Radial Properties:
maxRadius, maxRadiusVariance, minRadius, minRadiusVariance: Define the radial emission range.
rotatePerSecond, rotatePerSecondVariance: Rotation speed of particles.
Particle Properties:
particleLifespan, particleLifespanVariance: Particle lifetime.
start/finishParticleSize (+ variances): Particle size over time.
rotationStart/End (+ variances): Particle rotation over time.
Color/Alpha Properties:
start/finishColor[Red/Green/Blue/Alpha] (+variances): Color transitions over a particle's lifetime.
Blend Modes:
blendFuncSource, blendFuncDestination: Control how particles blend with the background (refer to OpenGL-ES 2 specification for values).
Remove_Emitter()
Syntax: _Remove_Emitter(ImageName, EmitterName)
Purpose: Detaches and stops an emitter from an image.
Parameters:
ImageName: Name of the image (can use wildcards).
EmitterName: Exact name of the emitter to remove.
Trajectory_Emitter()
Syntax: _Trajectory_Emitter(trajectory_name, emitter_file_name, trajectory_points, speed_msecs_per_segment, initial_delay, function_to_run_when_completed)
Purpose: Moves an emitter along a defined path.