CPU-based 2D particle emitter.
    public class CPUParticles2D : Node2D

CPU-based 2D particle node used to create a variety of particle systems and effects.

See also Particles2D, which provides the same functionality with hardware acceleration, but may not run on older devices.

Inheritance Chain

Constructors

    public CPUParticles2D()

Properties

    public int Amount { get; set; }

Number of particles emitted in one emission cycle.

    public float Angle { get; set; }

Initial rotation applied to each particle, in degrees.

    public Curve AngleCurve { get; set; }

Each particle’s rotation will be animated along this Curve.

    public float AngleRandom { get; set; }

Rotation randomness ratio.

    public float AngularVelocity { get; set; }

Initial angular velocity applied to each particle. Sets the speed of rotation of the particle.

    public Curve AngularVelocityCurve { get; set; }

Each particle’s angular velocity will vary along this Curve.

    public float AngularVelocityRandom { get; set; }

Angular velocity randomness ratio.

    public float AnimOffset { get; set; }

Particle animation offset.

    public Curve AnimOffsetCurve { get; set; }

Each particle’s animation offset will vary along this Curve.

    public float AnimOffsetRandom { get; set; }

Animation offset randomness ratio.

    public float AnimSpeed { get; set; }

Particle animation speed.

    public Curve AnimSpeedCurve { get; set; }

Each particle’s animation speed will vary along this Curve.

    public float AnimSpeedRandom { get; set; }

Animation speed randomness ratio.

    public Color Color { get; set; }

Each particle’s initial color. If Texture is defined, it will be multiplied by this color.

    public Gradient ColorRamp { get; set; }

Each particle’s color will vary along this Gradient.

    public float Damping { get; set; }

The rate at which particles lose velocity.

    public Curve DampingCurve { get; set; }

Damping will vary along this Curve.

    public float DampingRandom { get; set; }

Damping randomness ratio.

    public Vector2 Direction { get; set; }

Unit vector specifying the particles’ emission direction.

    public DrawOrderEnum DrawOrder { get; set; }

Particle draw order. Uses DrawOrder values.

    public Color[] EmissionColors { get; set; }

    public Vector2[] EmissionNormals { get; set; }

    public Vector2[] EmissionPoints { get; set; }

    public Vector2 EmissionRectExtents { get; set; }

The rectangle’s extents if EmissionShape is set to [constant EMISSION_SHAPE_RECTANGLE].

    public EmissionShapeEnum EmissionShape { get; set; }

Particles will be emitted inside this region. See EmissionShape for possible values.

    public float EmissionSphereRadius { get; set; }

The sphere’s radius if EmissionShape is set to [constant EMISSION_SHAPE_SPHERE].

    public bool Emitting { get; set; }

If true, particles are being emitted.

    public float Explosiveness { get; set; }

How rapidly particles in an emission cycle are emitted. If greater than 0, there will be a gap in emissions before the next cycle begins.

    public int FixedFps { get; set; }

The particle system’s frame rate is fixed to a value. For instance, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself.

    public bool FlagAlignY { get; set; }

Align Y axis of particle with the direction of its velocity.

    public float Flatness { get; set; }

    public bool FractDelta { get; set; }

If true, results in fractional delta calculation which has a smoother particles display effect.

    public Vector2 Gravity { get; set; }

Gravity applied to every particle.

    public float HueVariation { get; set; }

Initial hue variation applied to each particle.

    public Curve HueVariationCurve { get; set; }

Each particle’s hue will vary along this Curve.

    public float HueVariationRandom { get; set; }

Hue variation randomness ratio.

    public float InitialVelocity { get; set; }

Initial velocity magnitude for each particle. Direction comes from Spread and the node’s orientation.

    public float InitialVelocityRandom { get; set; }

Initial velocity randomness ratio.

    public float Lifetime { get; set; }

Amount of time each particle will exist.

    public float LifetimeRandomness { get; set; }

Particle lifetime randomness ratio.

    public float LinearAccel { get; set; }

Linear acceleration applied to each particle in the direction of motion.

    public Curve LinearAccelCurve { get; set; }

Each particle’s linear acceleration will vary along this Curve.

    public float LinearAccelRandom { get; set; }

Linear acceleration randomness ratio.

    public bool LocalCoords { get; set; }

If true, particles use the parent node’s coordinate space. If false, they use global coordinates.

    public Texture Normalmap { get; set; }

Normal map to be used for the Texture property.

    public bool OneShot { get; set; }

If true, only one emission cycle occurs. If set true during a cycle, emission will stop at the cycle’s end.

    public float OrbitVelocity { get; set; }

Orbital velocity applied to each particle. Makes the particles circle around origin. Specified in number of full rotations around origin per second.

    public Curve OrbitVelocityCurve { get; set; }

Each particle’s orbital velocity will vary along this Curve.

    public float OrbitVelocityRandom { get; set; }

Orbital velocity randomness ratio.

    public float Preprocess { get; set; }

Particle system starts as if it had already run for this many seconds.

    public float RadialAccel { get; set; }

Radial acceleration applied to each particle. Makes particle accelerate away from origin.

    public Curve RadialAccelCurve { get; set; }

Each particle’s radial acceleration will vary along this Curve.

    public float RadialAccelRandom { get; set; }

Radial acceleration randomness ratio.

    public float Randomness { get; set; }

Emission lifetime randomness ratio.

    public float ScaleAmount { get; set; }

Initial scale applied to each particle.

    public Curve ScaleAmountCurve { get; set; }

Each particle’s scale will vary along this Curve.

    public float ScaleAmountRandom { get; set; }

Scale randomness ratio.

    public float SpeedScale { get; set; }

Particle system’s running speed scaling ratio. A value of 0 can be used to pause the particles.

    public float Spread { get; set; }

Each particle’s initial direction range from +spread to -spread degrees.

    public float TangentialAccel { get; set; }

Tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle’s velocity giving the particles a swirling motion.

    public Curve TangentialAccelCurve { get; set; }

Each particle’s tangential acceleration will vary along this Curve.

    public float TangentialAccelRandom { get; set; }

Tangential acceleration randomness ratio.

    public Texture Texture { get; set; }

Particle texture. If null, particles will be squares.

Methods

    public void ConvertFromParticles(Node particles)

Sets this node’s properties to match a given Particles2D node with an assigned ParticlesMaterial.

    [Obsolete("GetAmount is deprecated. Use the Amount property instead.")]
    public int GetAmount()

Getter for Amount

    [Obsolete("GetColor is deprecated. Use the Color property instead.")]
    public Color GetColor()

Getter for Color

    [Obsolete("GetColorRamp is deprecated. Use the ColorRamp property instead.")]
    public Gradient GetColorRamp()

Getter for ColorRamp

    [Obsolete("GetDirection is deprecated. Use the Direction property instead.")]
    public Vector2 GetDirection()

Getter for Direction

    [Obsolete("GetDrawOrder is deprecated. Use the DrawOrder property instead.")]
    public DrawOrderEnum GetDrawOrder()

Getter for DrawOrder

    [Obsolete("GetEmissionColors is deprecated. Use the EmissionColors property instead.")]
    public Color[] GetEmissionColors()

Getter for EmissionColors

    [Obsolete("GetEmissionNormals is deprecated. Use the EmissionNormals property instead.")]
    public Vector2[] GetEmissionNormals()

Getter for EmissionNormals

    [Obsolete("GetEmissionPoints is deprecated. Use the EmissionPoints property instead.")]
    public Vector2[] GetEmissionPoints()

Getter for EmissionPoints

    [Obsolete("GetEmissionRectExtents is deprecated. Use the EmissionRectExtents property instead.")]
    public Vector2 GetEmissionRectExtents()

Getter for EmissionRectExtents

    [Obsolete("GetEmissionShape is deprecated. Use the EmissionShape property instead.")]
    public EmissionShapeEnum GetEmissionShape()

Getter for EmissionShape

    [Obsolete("GetEmissionSphereRadius is deprecated. Use the EmissionSphereRadius property instead.")]
    public float GetEmissionSphereRadius()

Getter for EmissionSphereRadius

    [Obsolete("GetExplosivenessRatio is deprecated. Use the Explosiveness property instead.")]
    public float GetExplosivenessRatio()

Getter for Explosiveness

    [Obsolete("GetFixedFps is deprecated. Use the FixedFps property instead.")]
    public int GetFixedFps()

Getter for FixedFps

    [Obsolete("GetFlatness is deprecated. Use the Flatness property instead.")]
    public float GetFlatness()

Getter for Flatness

    [Obsolete("GetFractionalDelta is deprecated. Use the FractDelta property instead.")]
    public bool GetFractionalDelta()

Getter for FractDelta

    [Obsolete("GetGravity is deprecated. Use the Gravity property instead.")]
    public Vector2 GetGravity()

Getter for Gravity

    [Obsolete("GetLifetime is deprecated. Use the Lifetime property instead.")]
    public float GetLifetime()

Getter for DrawOrderEnum.Lifetime

    [Obsolete("GetLifetimeRandomness is deprecated. Use the LifetimeRandomness property instead.")]
    public float GetLifetimeRandomness()

Getter for LifetimeRandomness

    [Obsolete("GetNormalmap is deprecated. Use the Normalmap property instead.")]
    public Texture GetNormalmap()

Getter for Normalmap

    [Obsolete("GetOneShot is deprecated. Use the OneShot property instead.")]
    public bool GetOneShot()

Getter for OneShot

    [Obsolete("GetParam is deprecated. Use the AnimOffset property instead.")]
    public float GetParam(Parameter param)

    [Obsolete("GetParamCurve is deprecated. Use the AnimOffsetCurve property instead.")]
    public Curve GetParamCurve(Parameter param)

    [Obsolete("GetParamRandomness is deprecated. Use the AnimOffsetRandom property instead.")]
    public float GetParamRandomness(Parameter param)

    [Obsolete("GetParticleFlag is deprecated. Use the FlagAlignY property instead.")]
    public bool GetParticleFlag(Flags flag)

    [Obsolete("GetPreProcessTime is deprecated. Use the Preprocess property instead.")]
    public float GetPreProcessTime()

Getter for Preprocess

    [Obsolete("GetRandomnessRatio is deprecated. Use the Randomness property instead.")]
    public float GetRandomnessRatio()

Getter for Randomness

    [Obsolete("GetSpeedScale is deprecated. Use the SpeedScale property instead.")]
    public float GetSpeedScale()

Getter for SpeedScale

    [Obsolete("GetSpread is deprecated. Use the Spread property instead.")]
    public float GetSpread()

Getter for Spread

    [Obsolete("GetTexture is deprecated. Use the Texture property instead.")]
    public Texture GetTexture()

Getter for Texture

    [Obsolete("GetUseLocalCoordinates is deprecated. Use the LocalCoords property instead.")]
    public bool GetUseLocalCoordinates()

Getter for LocalCoords

    [Obsolete("IsEmitting is deprecated. Use the Emitting property instead.")]
    public bool IsEmitting()

Getter for Emitting

    public void Restart()

Restarts the particle emitter.

    [Obsolete("SetAmount is deprecated. Use the Amount property instead.")]
    public void SetAmount(int amount)

Setter for Amount

    [Obsolete("SetColor is deprecated. Use the Color property instead.")]
    public void SetColor(Color color)

Setter for Color

    [Obsolete("SetColorRamp is deprecated. Use the ColorRamp property instead.")]
    public void SetColorRamp(Gradient ramp)

Setter for ColorRamp

    [Obsolete("SetDirection is deprecated. Use the Direction property instead.")]
    public void SetDirection(Vector2 direction)

Setter for Direction

    [Obsolete("SetDrawOrder is deprecated. Use the DrawOrder property instead.")]
    public void SetDrawOrder(DrawOrderEnum order)

Setter for DrawOrder

    [Obsolete("SetEmissionColors is deprecated. Use the EmissionColors property instead.")]
    public void SetEmissionColors(Color[] array)

Setter for EmissionColors

    [Obsolete("SetEmissionNormals is deprecated. Use the EmissionNormals property instead.")]
    public void SetEmissionNormals(Vector2[] array)

Setter for EmissionNormals

    [Obsolete("SetEmissionPoints is deprecated. Use the EmissionPoints property instead.")]
    public void SetEmissionPoints(Vector2[] array)

Setter for EmissionPoints

    [Obsolete("SetEmissionRectExtents is deprecated. Use the EmissionRectExtents property instead.")]
    public void SetEmissionRectExtents(Vector2 extents)

Setter for EmissionRectExtents

    [Obsolete("SetEmissionShape is deprecated. Use the EmissionShape property instead.")]
    public void SetEmissionShape(EmissionShapeEnum shape)

Setter for EmissionShape

    [Obsolete("SetEmissionSphereRadius is deprecated. Use the EmissionSphereRadius property instead.")]
    public void SetEmissionSphereRadius(float radius)

Setter for EmissionSphereRadius

    [Obsolete("SetEmitting is deprecated. Use the Emitting property instead.")]
    public void SetEmitting(bool emitting)

Setter for Emitting

    [Obsolete("SetExplosivenessRatio is deprecated. Use the Explosiveness property instead.")]
    public void SetExplosivenessRatio(float ratio)

Setter for Explosiveness

    [Obsolete("SetFixedFps is deprecated. Use the FixedFps property instead.")]
    public void SetFixedFps(int fps)

Setter for FixedFps

    [Obsolete("SetFlatness is deprecated. Use the Flatness property instead.")]
    public void SetFlatness(float amount)

Setter for Flatness

    [Obsolete("SetFractionalDelta is deprecated. Use the FractDelta property instead.")]
    public void SetFractionalDelta(bool enable)

Setter for FractDelta

    [Obsolete("SetGravity is deprecated. Use the Gravity property instead.")]
    public void SetGravity(Vector2 accelVec)

Setter for Gravity

    [Obsolete("SetLifetime is deprecated. Use the Lifetime property instead.")]
    public void SetLifetime(float secs)

Setter for DrawOrderEnum.Lifetime

    [Obsolete("SetLifetimeRandomness is deprecated. Use the LifetimeRandomness property instead.")]
    public void SetLifetimeRandomness(float random)

Setter for LifetimeRandomness

    [Obsolete("SetNormalmap is deprecated. Use the Normalmap property instead.")]
    public void SetNormalmap(Texture normalmap)

Setter for Normalmap

    [Obsolete("SetOneShot is deprecated. Use the OneShot property instead.")]
    public void SetOneShot(bool enable)

Setter for OneShot

    [Obsolete("SetParam is deprecated. Use the AnimOffset property instead.")]
    public void SetParam(Parameter param, float value)

    [Obsolete("SetParamCurve is deprecated. Use the AnimOffsetCurve property instead.")]
    public void SetParamCurve(Parameter param, Curve curve)

    [Obsolete("SetParamRandomness is deprecated. Use the AnimOffsetRandom property instead.")]
    public void SetParamRandomness(Parameter param, float randomness)

    [Obsolete("SetParticleFlag is deprecated. Use the FlagAlignY property instead.")]
    public void SetParticleFlag(Flags flag, bool enable)

    [Obsolete("SetPreProcessTime is deprecated. Use the Preprocess property instead.")]
    public void SetPreProcessTime(float secs)

Setter for Preprocess

    [Obsolete("SetRandomnessRatio is deprecated. Use the Randomness property instead.")]
    public void SetRandomnessRatio(float ratio)

Setter for Randomness

    [Obsolete("SetSpeedScale is deprecated. Use the SpeedScale property instead.")]
    public void SetSpeedScale(float scale)

Setter for SpeedScale

    [Obsolete("SetSpread is deprecated. Use the Spread property instead.")]
    public void SetSpread(float degrees)

Setter for Spread

    [Obsolete("SetTexture is deprecated. Use the Texture property instead.")]
    public void SetTexture(Texture texture)

Setter for Texture

    [Obsolete("SetUseLocalCoordinates is deprecated. Use the LocalCoords property instead.")]
    public void SetUseLocalCoordinates(bool enable)

Setter for LocalCoords

Inner Types

DrawOrderEnum

Name Value Description
Index 0 Particles are drawn in the order emitted.
Lifetime 1 Particles are drawn in order of remaining lifetime.

EmissionShapeEnum

Name Value Description
Point 0 All particles will be emitted from a single point.
Sphere 1 Particles will be emitted on the surface of a sphere flattened to two dimensions.
Rectangle 2 Particles will be emitted in the area of a rectangle.
Points 3 Particles will be emitted at a position chosen randomly among [member emission_points]. Particle color will be modulated by [member emission_colors].
DirectedPoints 4 Particles will be emitted at a position chosen randomly among [member emission_points]. Particle velocity and rotation will be set based on [member emission_normals]. Particle color will be modulated by [member emission_colors].

Flags

Name Value Description
AlignYToVelocity 0 Use with [method set_particle_flag] to set [member flag_align_y].
RotateY 1 Present for consistency with 3D particle nodes, not used in 2D.
DisableZ 2 Present for consistency with 3D particle nodes, not used in 2D.
Max 3 Represents the size of the [enum Flags] enum.

Parameter

Name Value Description
InitialLinearVelocity 0 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set initial velocity properties.
AngularVelocity 1 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set angular velocity properties.
OrbitVelocity 2 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set orbital velocity properties.
LinearAccel 3 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set linear acceleration properties.
RadialAccel 4 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set radial acceleration properties.
TangentialAccel 5 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set tangential acceleration properties.
Damping 6 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set damping properties.
Angle 7 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set angle properties.
Scale 8 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set scale properties.
HueVariation 9 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set hue variation properties.
AnimSpeed 10 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set animation speed properties.
AnimOffset 11 Use with [method set_param], [method set_param_randomness], and [method set_param_curve] to set animation offset properties.
Max 12 Represents the size of the [enum Parameter] enum.
Tags: