natiny.render.particles

Lua
natiny.render.particles(particles)

Draws a particle system in 2D, in the coordinates of the current render target, over what was drawn before it.

Parameters

Name Type Description
particles number Particle system handle from natiny.particles.create

Example

Lua
local sparkle = natiny.particles.create(1000)
natiny.particles.set_shape(sparkle, natiny.particles.SHAPE_CIRCLE, 16)
natiny.particles.set_speed(sparkle, 40, 120)
natiny.particles.set_size(sparkle, 8, 20)
natiny.particles.set_blend(sparkle, natiny.particles.BLEND_ADD)

natiny.backend.loop(function(dt)
    natiny.entity.set_position(sparkle, natiny.entity.SPACE_WORLD,
                               natiny.input.get_mouse_x(), natiny.input.get_mouse_y(), 0)
    natiny.window.bind(window, function()
        natiny.render.clear(background)
        natiny.render.particles(sparkle)
    end)
end)