LightRenderer

The LightRenderer component renders a circular light source. It works by illuminating areas within a darkness mask, so it requires a DarknessRenderer in the scene to have any effect. It uses the entity’s Transform for position. See Rendering for an overview.

Options

OptionTypeDefaultDescription
radiusnumber0Light radius.
intensitynumber1Light intensity between 0 and 1.
smoothbooleanfalseSoftens the light’s edge.
layerstring"Default"The darkness layer this light affects.

Example

import { Transform, LightRenderer } from "angry-pixel";

this.entityManager.createEntity([
    new Transform(),
    new LightRenderer({
        radius: 100,
        intensity: 0.8,
        smooth: true,
        layer: "Darkness",
    }),
]);

The layer must match the layer of the DarknessRenderer it illuminates.