Particles2D

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

2D Particle emitter

Member Functions

int get_amount ( ) const
Color get_color ( ) const
Color get_color_phase_color ( int phase ) const
float get_color_phase_pos ( int phase ) const
int get_color_phases ( ) const
ColorRamp get_color_ramp ( ) const
Vector2 get_emission_half_extents ( ) const
Vector2Array get_emission_points ( ) const
Vector2 get_emissor_offset ( ) const
float get_emit_timeout ( ) const
float get_explosiveness ( ) const
int get_h_frames ( ) const
Vector2 get_initial_velocity ( ) const
float get_lifetime ( ) const
float get_param ( int param ) const
float get_pre_process_time ( ) const
float get_randomness ( int param ) const
Texture get_texture ( ) const
float get_time_scale ( ) const
int get_v_frames ( ) const
bool is_emitting ( ) const
bool is_flipped_h ( ) const
bool is_flipped_v ( ) const
bool is_using_local_space ( ) const
void pre_process ( float time )
void reset ( )
void set_amount ( int amount )
void set_color ( Color color )
void set_color_phase_color ( int phase, Color color )
void set_color_phase_pos ( int phase, float pos )
void set_color_phases ( int phases )
ColorRamp set_color_ramp ( Object color_ramp )
void set_emission_half_extents ( Vector2 extents )
void set_emission_points ( Vector2Array points )
void set_emissor_offset ( Vector2 offset )
void set_emit_timeout ( float value )
void set_emitting ( bool active )
void set_explosiveness ( float amount )
void set_flip_h ( bool enable )
void set_flip_v ( bool enable )
void set_h_frames ( int enable )
void set_initial_velocity ( Vector2 velocity )
void set_lifetime ( float lifetime )
void set_param ( int param, float value )
void set_pre_process_time ( float time )
void set_randomness ( int param, float value )
Texture set_texture ( Object texture )
void set_time_scale ( float time_scale )
void set_use_local_space ( bool enable )
void set_v_frames ( int enable )

Numeric Constants

  • PARAM_DIRECTION = 0 — Direction in radians at which the particles will be launched, Notice that when the direction is set to 0 the particles will be launched to the negative
  • PARAM_SPREAD = 1
  • PARAM_LINEAR_VELOCITY = 2 — Velocity at which the particles will be launched.
  • PARAM_SPIN_VELOCITY = 3 — The speed at which particles will spin around its own center.
  • PARAM_ORBIT_VELOCITY = 4 — Velocity at which the particles will orbit around the emitter center
  • PARAM_GRAVITY_DIRECTION = 5 — Direction in radians at which the particles will be attracted
  • PARAM_GRAVITY_STRENGTH = 6 — Strength of the gravitation attraction for each particle
  • PARAM_RADIAL_ACCEL = 7
  • PARAM_TANGENTIAL_ACCEL = 8
  • PARAM_DAMPING = 9 — Amount of damping for each particle
  • PARAM_INITIAL_ANGLE = 10 — Initial angle in radians at which each particle will be spawned
  • PARAM_INITIAL_SIZE = 11 — Initial size of each particle
  • PARAM_FINAL_SIZE = 12 — Final size of each particle, the particle size will interpolate to this value during its lifetime.
  • PARAM_HUE_VARIATION = 13
  • PARAM_ANIM_SPEED_SCALE = 14
  • PARAM_ANIM_INITIAL_POS = 15
  • PARAM_MAX = 16
  • MAX_COLOR_PHASES = 4

Description

Particles2D is a particle system 2D Node that is used to simulate several types of particle effects, such as explosions, rain, snow, fireflies, or other magical-like shinny sparkles. Particles are drawn using impostors, and given their dynamic behavior, the user must provide a visibility AABB (although helpers to create one automatically exist).

Member Function Description

  • int get_amount ( ) const

Returns the amount of particles spawned at each emission

  • Color get_color ( ) const

Returns the tint color for each particle.

  • Color get_color_phase_color ( int phase ) const
  • float get_color_phase_pos ( int phase ) const
  • int get_color_phases ( ) const

Returns the ColorRamp used to tint each particle

  • Vector2 get_emission_half_extents ( ) const

Returns the half extents of the emission box.

  • Vector2 get_emissor_offset ( ) const

Returns the particle spawn origin position relative to the emitter.

  • float get_emit_timeout ( ) const

Returns the amount of seconds during which the emitter will spawn particles

  • float get_explosiveness ( ) const
  • int get_h_frames ( ) const
  • Vector2 get_initial_velocity ( ) const
  • float get_lifetime ( ) const

Gets the amount of seconds that each particle will be visible.

Returns the value of the specified emitter parameter

  • float get_pre_process_time ( ) const
  • float get_randomness ( int param ) const

Returns the randomness value of the specified emitter parameter

Returns the texture for emitted particles

  • float get_time_scale ( ) const

Returns the emitter time scale

  • int get_v_frames ( ) const
  • bool is_emitting ( ) const

Returns whether this emitter is currently emitting or not

  • bool is_flipped_h ( ) const
  • bool is_flipped_v ( ) const
  • bool is_using_local_space ( ) const
  • void pre_process ( float time )
  • void reset ( )
  • void set_amount ( int amount )

Sets the amount of particles spawned at each emission

  • void set_color ( Color color )

Set the tint color for each particle.

  • void set_color_phase_color ( int phase, Color color )
  • void set_color_phase_pos ( int phase, float pos )
  • void set_color_phases ( int phases )

Sets the ColorRamp used to tint each particle. Particle will be tinted according to their lifetimes.

  • void set_emission_half_extents ( Vector2 extents )

Sets the half extents of the emission box, particles will be spawned at random inside this box.

  • void set_emissor_offset ( Vector2 offset )

Sets the particle spawn origin position relative to the emitter center. for example if this value is set to (50, 50), the particle will spawn 50 units to the right and 50 units to the bottom of the emitter center.

  • void set_emit_timeout ( float value )

Sets the amount of seconds during which the emitter will spawn particles, after the specified seconds the emitter state will be set to non emitting, so calling is_emitting will return false. If the timeout is 0 the emitter will spawn forever.

  • void set_emitting ( bool active )

If this is set to true then the particle emitter will emit particles, if its false it will not.

  • void set_explosiveness ( float amount )
  • void set_flip_h ( bool enable )
  • void set_flip_v ( bool enable )
  • void set_h_frames ( int enable )
  • void set_initial_velocity ( Vector2 velocity )
  • void set_lifetime ( float lifetime )

Sets the amount of seconds that each particle will be visible.

  • void set_param ( int param, float value )

Sets the value of the specified emitter parameter (see the constants secction for the list of parameters)

  • void set_pre_process_time ( float time )
  • void set_randomness ( int param, float value )

Sets the randomness value of the specified emitter parameter (see the constants secction for the list of parameters), 0 means no randomness, so every particle will have the parameters specified, 1 means that the parameter will be choosen at random, the closer the randomness value gets to 0 the more conservative the variation of the parameter will be.

Sets the texture for each particle

  • void set_time_scale ( float time_scale )

Sets the increment or decrement for the particle lifetime. for example: if the time scale is set to 2, the particles will die and move twice as fast.

  • void set_use_local_space ( bool enable )
  • void set_v_frames ( int enable )