Module ncine.particle_system
The table containing particle system related functions.
Inherits from ncine.scenenode.
Functions
Tables
particlesystemObj | The light user data of a particle system object. |
particle_initializer | An initializer table with random ranges used to emit particles. |
Functions
- ncine.particle_system.new (parent, count, texture, tex_rect)
-
Constructs a particle system.
Don’t forget to call ncine.particle_system.delete when you are done with it!
Parameters:
- parent ncine.scenenode.scenenodeObj or nil The parent scenenode
- count integer Maximum amount of particles
- texture ncine.texture.textureObj or nil
- tex_rect ncine.rect
Returns:
-
particlesystemObj
A new particle system object
- ncine.particle_system.clone (particle_system)
-
Constructs a new particle system object as a clone of the specified one.
Don’t forget to call ncine.particle_system.delete when you are done with it!
Parameters:
- particle_system particlesystemObj The particle system object to be cloned
Returns:
-
particlesystemObj
The cloned particle system object
- ncine.particle_system.delete (particle_system)
-
Destroys a particle system object and releases its memory
Parameters:
- particle_system particlesystemObj The particle system object to be destroyed
- ncine.particle_system.add_color_affector (particle_system, color_steps)
-
Adds a color particle affector
Parameters:
- particle_system particlesystemObj
- color_steps ncine.particle_affector.affector_color_step[]
- ncine.particle_system.add_size_affector (particle_system, base_scale, size_steps)
-
Adds a size particle affector
Parameters:
- particle_system particlesystemObj
- base_scale number
- size_steps ncine.particle_affector.affector_size_step_factor[]
- ncine.particle_system.add_size_affector (particle_system, base_scale, size_steps)
-
Adds a size particle affector
Parameters:
- particle_system particlesystemObj
- base_scale number
- size_steps ncine.particle_affector.affector_size_step_vector[]
- ncine.particle_system.add_rotation_affector (particle_system, rotation_steps)
-
Adds a rotation particle affector
Parameters:
- particle_system particlesystemObj
- rotation_steps ncine.particle_affector.affector_rotation_step[]
- ncine.particle_system.add_position_affector (particle_system, position_steps)
-
Adds a position particle affector
Parameters:
- particle_system particlesystemObj
- position_steps ncine.particle_affector.affector_position_step[]
- ncine.particle_system.add_velocity_affector (particle_system, velocity_steps)
-
Adds a velocity particle affector
Parameters:
- particle_system particlesystemObj
- velocity_steps ncine.particle_affector.affector_velocity_step[]
- ncine.particle_system.num_affectors (particle_system)
-
Returns the number of affectors
Parameters:
- particle_system particlesystemObj
Returns:
-
integer
- ncine.particle_system.get_affector (particle_system, index)
-
Returns the affector at the specified index
Parameters:
- particle_system particlesystemObj
- index integer
Returns:
-
ncine.particle_affector.affectorObj or nil
- ncine.particle_system.remove_affector (particle_system, index)
-
Removes the affector at the specified index
Parameters:
- particle_system particlesystemObj
- index integer
- ncine.particle_system.clear_affectors (particle_system)
-
Deletes all particle affectors
Parameters:
- particle_system particlesystemObj
- ncine.particle_system.emit_particles (particle_system, initializer)
-
Emits particles with the specified initialization parameters
Parameters:
- particle_system particlesystemObj
- initializer particle_initializer
- ncine.particle_system.kill_particles (particle_system)
-
Kills all alive particles
Parameters:
- particle_system particlesystemObj
- ncine.particle_system.get_in_local_space (particle_system)
-
Returns
true
if particles are positioned using the particle system as their originParameters:
- particle_system particlesystemObj
Returns:
-
boolean
- ncine.particle_system.set_in_local_space (particle_system, local_space)
-
Sets or clears the local space flag, to move particles around the particle system or freely
Parameters:
- particle_system particlesystemObj
- local_space boolean
- ncine.particle_system.get_particles_update_enabled (particle_system)
-
Returns
true
if particles are updatingParameters:
- particle_system particlesystemObj
Returns:
-
boolean
- ncine.particle_system.set_particles_update_enabled (particle_system, enabled)
-
Enables or disables particles updating
Parameters:
- particle_system particlesystemObj
- enabled boolean
- ncine.particle_system.get_affectors_enabled (particle_system)
-
Returns
true
if affectors are modifying particles propertiesParameters:
- particle_system particlesystemObj
Returns:
-
boolean
- ncine.particle_system.set_affectors_enabled (particle_system, enabled)
-
Enables or disables affectors modifying particles properties
Parameters:
- particle_system particlesystemObj
- enabled boolean
- ncine.particle_system.num_particles (particle_system)
-
Returns the total number of particles in the system
Parameters:
- particle_system particlesystemObj
Returns:
-
integer
- ncine.particle_system.num_alive_particles (particle_system)
-
Returns the number of particles currently alive
Parameters:
- particle_system particlesystemObj
Returns:
-
integer
- ncine.particle_system.set_texture (particle_system, texture)
-
Sets the texture object for every particle in the system
Parameters:
- particle_system particlesystemObj
- texture ncine.texture.textureObj
- ncine.particle_system.set_texture_rect (particle_system, tex_rect)
-
Sets the texture source rectangle for every particle in the system
Parameters:
- particle_system particlesystemObj
- tex_rect ncine.rect
- ncine.particle_system.set_anchor_point (particle_system, point)
-
Sets the transformation anchor point for every particle in the system with a
ncine.vec2
Parameters:
- particle_system particlesystemObj
- point ncine.vec2
- ncine.particle_system.set_anchor_point (particle_system, point_x, point_y)
-
Sets the transformation anchor point for every particle in the system
Parameters:
- particle_system particlesystemObj
- point_x number
- point_y number
- ncine.particle_system.set_flipped_x (particle_system, flipped_x)
-
Flips the texture rect horizontally for every particle in the system
Parameters:
- particle_system particlesystemObj
- flipped_x boolean
- ncine.particle_system.set_flipped_y (particle_system, flipped_y)
-
Flips the texture rect vertically for every particle in the system
Parameters:
- particle_system particlesystemObj
- flipped_y boolean
- ncine.particle_system.set_blending_preset (particle_system, blending_preset)
-
Sets the blending factors preset for every particle in the system
Parameters:
- particle_system particlesystemObj
- blending_preset ncine.blending_preset
- ncine.particle_system.set_blending_factors (particle_system, src_factor, dest_factor)
-
Sets the source and destination blending factors for every particle in the system
Parameters:
- particle_system particlesystemObj
- src_factor ncine.blending_factor
- dest_factor ncine.blending_factor
- ncine.particle_system.set_layer (particle_system, layer)
-
Sets the rendering layer for every particle in the system
Parameters:
- particle_system particlesystemObj
- layer integer
Tables
- particlesystemObj
-
The light user data of a particle system object.
Inherits from ncine.scenenode.scenenodeObj.
- particle_initializer
-
An initializer table with random ranges used to emit particles.
Each field can be the precise value, or an array of two elements, to define a minimum and a maximum.
Fields:
- amount (number|number[2])
- life (number|number[2])
- position (ncine.vec2|ncine.vec2[2])
- velocity (ncine.vec2|ncine.vec2[2])
- rotation (number|number[2])