natiny.particles.create

Lua
natiny.particles.create(capacity [, parent]) -> particles

Creates a particle system: an emitter entity at the world origin and room for capacity live particles. It starts emitting at once.

Parameters

Name Type Default Description
capacity integer Most particles alive at the same time; must be above 0
parent number nil Entity to parent the emitter to

Returns

Type Description
number Particle system handle; raises an error when capacity is 0 or memory runs out

Example

Lua
local sparks = natiny.particles.create(512)
natiny.entity.set_position(sparks, natiny.entity.SPACE_WORLD, 0, 1, 0)

Notes

  • All particle memory is allocated here. Nothing allocates while the system runs; a system that is full stops spawning until particles die.