Skip to main content
Version: Phaser v4.0.0-rc.6

LightsPlugin

A Scene plugin that provides a Phaser.GameObjects.LightsManager for rendering objects with dynamic lighting.

Available from within a Scene via this.lights.

Add Lights using the Phaser.GameObjects.LightsManager#addLight method:


// Enable the Lights Manager because it is disabled by default

this.lights.enable();



// Create a Light at [400, 300] with a radius of 200

this.lights.addLight(400, 300, 200);

For Game Objects to be affected by the Lights when rendered, you will need to set them to use lighting like so:


sprite.setLighting(true);

Constructor

new LightsPlugin(scene)

Parameters

nametypeoptionaldescription
scenePhaser.SceneNoThe Scene that this Lights Plugin belongs to.

Scope: static

Extends

Phaser.GameObjects.LightsManager

Source: src/gameobjects/lights/LightsPlugin.js#L12
Since: 3.0.0

Inherited Members

From Phaser.GameObjects.LightsManager:


Public Members

scene

scene: Phaser.Scene

Description:

A reference to the Scene that this Lights Plugin belongs to.

Source: src/gameobjects/lights/LightsPlugin.js#L50
Since: 3.0.0


systems

systems: Phaser.Scenes.Systems

Description:

A reference to the Scene's systems.

Source: src/gameobjects/lights/LightsPlugin.js#L59
Since: 3.0.0


Inherited Methods

From Phaser.GameObjects.LightsManager:


Public Methods

boot

<instance> boot()

Description:

Boot the Lights Plugin.

Source: src/gameobjects/lights/LightsPlugin.js#L76
Since: 3.0.0


destroy

<instance> destroy()

Description:

Destroy the Lights Plugin.

Cleans up all references.

Overrides: Phaser.GameObjects.LightsManager#destroy

Source: src/gameobjects/lights/LightsPlugin.js#L90
Since: 3.0.0