Repository navigation
Particle Emitter API
An individual Particle Emitter, which can be constructed through Palette:CreateParticleEmitter.
Parameters
| Parameter | Type | Description |
|---|---|---|
subEmitter |
ParticleEmitter | |
trigger |
"Spawn" | "Death" | |
options |
SubEmitterOptions (optional) |
Returns: nil
Deletes all of the particles spawned by the Particle Emitter.
Returns: nil
Destroys the Particle Emitter. On deletion, all of its particles are cleared and the Particle Emitter can no longer be used.
Returns: nil
Manually spawns a set amount of particles. This works regardless of whether the Particle Emitter is continuously emitting particles or not. Does not spawn particles that would go over the emitter's cap defined by MaxParticles.
If the Particle Emitter is destroyed, an error will be thrown instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
count |
integer | The number of particles to spawn. |
positionOffset |
Vector (optional) |
Returns: nil
Causes the Particle Emitter to have its position set to the provided entity's position every frame as long as the entity is alive.
Passing nil to the function will instead cause the Particle Emitter to stop following an entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity |
Entity | nil | The entity to follow. |
followOffset |
Vector (optional) |
Returns: nil
Returns the entity the Particle Emitter is following. Returns nil if it's following no entity.
Returns: Entity | nil
Returns: integer
Returns whether the Particle Emitter was destroyed.
Returns: boolean
Returns whether the Particle Emitter is continuously emitting particles.
Returns: boolean
Returns whether the Particle Emitter is following an entity.
Returns: boolean
Returns: boolean
Returns: boolean
Returns whether the Particle Emitter is continuously emitting particles or at least one particle belonging to it is alive.
Returns: boolean
Returns: nil
Enables continuous particle emission.
Returns: nil
Parameters
| Parameter | Type | Description |
|---|---|---|
frames |
integer (optional) |
Returns: nil
Parameters
| Parameter | Type | Description |
|---|---|---|
subEmitter |
ParticleEmitter |
Returns: nil
Returns: nil
Returns: nil
Disables continuous particle emission.
Returns: nil
Forces a Particle Emitter and its particles to update its logic one frame. Only used for niche situations.
Returns: nil
| Property | Type | Default | Description |
|---|---|---|---|
AlignToVelocity |
AlignToVelocity | - | |
Bursts |
PaletteBurst[] | {} | |
ColorBySpeed |
ColorBySpeed | - | |
ColorOverLifetime |
ColorOverLifetime | - | A reference to the Particle Emitter's ColorOverLifetime module, which handles how particle colors change over its lifespan. |
DestroyOnFinish |
boolean | false | |
DirectionSpread |
number | 0 | Determines how spread apart particles are relative to StartDirection, in degrees. The angle is between -DirectionSpread and +DirectionSpread. |
Duration |
number | 150 | |
ForceOverLifetime |
ForceOverLifetime | - | |
GravityModifier |
number | {Min: number, Max: number} | 0 | |
InheritVelocity |
InheritVelocity | - | |
IsWorldSpace |
boolean | true | Whether particles are rendered using world coordinates or screen coordinates. |
Lifetime |
integer | {Min: integer, Max: integer} | 60 | How many game update frames each particle is alive for before it's destroyed. 30 game update frames is equal to 1 second. |
LimitVelocityOverLifetime |
LimitVelocityOverLifetime | - | |
Looping |
boolean | true | |
MaxParticles |
integer | 100 | The maximum amount of particles belonging to the Particle Emitter that can be alive. Additional particles from the Particle Emitter won't spawn while at that cap. |
Noise |
Noise | - | |
Orientation |
number | 0 | The orientation of the Particle Emitter, in degrees. Rotates the emission direction. |
ParticleRate |
number | 5 | How many particles are spawned throughout one second (30 game update frames) while the Particle Emitter is continuously emitting particles. |
PersistAcrossRooms |
boolean | false | Determines whether Particle Emitters are automatically destroyed when changing rooms or exiting a run. |
Position |
Vector | (0, 0) | The position of the Particle Emitter. |
RateOverDistance |
number | 0 | |
RenderMode |
RenderMode | "AboveEntities" | |
RotationBySpeed |
RotationBySpeed | - | |
RotationOverLifetime |
PaletteOverLifetime<number> | - | Controls particle rotation throughout its lifetime. |
ScaleBySpeed |
ScaleBySpeed | - | |
ScaleOverLifetime |
PaletteOverLifetime<Vector> | - | Controls particle size throughout its lifetime using multipliers. |
Shader |
Shader | nil | nil | |
ShaderParams |
table<string, number | number[]> | {} | |
Shape |
Shape | - | |
SpriteSheet |
SpriteSheet | - | |
StartColor |
KColor | {Min: KColor, Max: KColor} | KColor.White | The initial color of the spawned particle. |
StartDelay |
integer | 0 | |
StartDirection |
Vector | (0, -1) | The direction particles are spawned from relative to the Particle Emitter. |
StartRotation |
number | {Min: number, Max: number} | 0 | The initial sprite rotation of the particle, in degrees. |
StartScale |
Vector | {Min: Vector, Max: Vector} | (1, 1) | The initial size of particles when spawned. Acts as a scale multiplier to the particle's image file. |
StartSpeed |
number | {Min: number, Max: number} | 2 | The initial speed of particles spawned. |
VelocityOverLifetime |
VelocityOverLifetime | - | A reference to the Particle Emitter's VelocityOverLifetime module, which handles how the particle's velocity change over its lifespan. |
Note
Certain properties, such as StartSpeed, Lifetime, StartColor, StartScale, and StartRotation, support randomized values using a { Min = ..., Max = ... } table. See Getting Started for an introduction to randomized particle properties.
RenderMode accepts the following values:
"Floor""BehindEntities""AboveEntities""AboveHUD""AbovePause""MainMenu"
- Palette API
- Particle Emitter API
- AlignToVelocity API
- ColorBySpeed API
- ColorOverLifetime API
- ForceOverLifetime API
- InheritVelocity API
- Keyframe API
- LimitVelocityOverLifetime API
- Noise API
- PaletteBurst API
- PaletteGradient API
- PaletteOverLifetime API
- RotationBySpeed API
- ScaleBySpeed API
- Shape API
- SpriteSheet API
- SubEmitterOptions API
- VelocityOverLifetime API