Table of Contents

Class Light2D

Casts light in a 2D environment.

Inheritance
Light2D
Derived

Remarks

Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).

See Also

Properties

blend_mode

The Light2D's blend mode. See BlendMode constants for values.

var blend_mode : int = 0

Property Value

int

Remarks

  • void set_blend_mode(int value)
  • int get_blend_mode

color

The Light2D's Color.

var color : Color = Color(1, 1, 1, 1)

Property Value

Color

Remarks

editor_only

If true, Light2D will only appear when editing the scene.

var editor_only : bool = false

Property Value

bool

Remarks

  • void set_editor_only(bool value)
  • bool is_editor_only

enabled

If true, Light2D will emit light.

var enabled : bool = true

Property Value

bool

Remarks

  • void set_enabled(bool value)
  • bool is_enabled

energy

The Light2D's energy value. The larger the value, the stronger the light.

var energy : float = 1.0

Property Value

float

Remarks

range_item_cull_mask

The layer mask. Only objects with a matching light_mask will be affected by the Light2D. See also shadow_item_cull_mask, which affects which objects can cast shadows.

Note: range_item_cull_mask is ignored by DirectionalLight2D, which will always light a 2D node regardless of the 2D node's light_mask.

var range_item_cull_mask : int = 1

Property Value

int

Remarks

  • void set_item_cull_mask(int value)
  • int get_item_cull_mask

range_layer_max

Maximum layer value of objects that are affected by the Light2D.

var range_layer_max : int = 0

Property Value

int

Remarks

  • void set_layer_range_max(int value)
  • int get_layer_range_max

range_layer_min

Minimum layer value of objects that are affected by the Light2D.

var range_layer_min : int = 0

Property Value

int

Remarks

  • void set_layer_range_min(int value)
  • int get_layer_range_min

range_z_max

Maximum z value of objects that are affected by the Light2D.

var range_z_max : int = 1024

Property Value

int

Remarks

  • void set_z_range_max(int value)
  • int get_z_range_max

range_z_min

Minimum z value of objects that are affected by the Light2D.

var range_z_min : int = -1024

Property Value

int

Remarks

  • void set_z_range_min(int value)
  • int get_z_range_min

shadow_color

Color of shadows cast by the Light2D.

var shadow_color : Color = Color(0, 0, 0, 0)

Property Value

Color

Remarks

  • void set_shadow_color(Color value)
  • Color get_shadow_color

shadow_enabled

If true, the Light2D will cast shadows.

var shadow_enabled : bool = false

Property Value

bool

Remarks

  • void set_shadow_enabled(bool value)
  • bool is_shadow_enabled

shadow_filter

Shadow filter type. See ShadowFilter for possible values.

var shadow_filter : int = 0

Property Value

int

Remarks

  • void set_shadow_filter(int value)
  • int get_shadow_filter

shadow_filter_smooth

Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. shadow_filter_smooth only has an effect if shadow_filter is Light2D.SHADOW_FILTER_PCF5 or Light2D.SHADOW_FILTER_PCF13.

var shadow_filter_smooth : float = 0.0

Property Value

float

Remarks

  • void set_shadow_smooth(float value)
  • float get_shadow_smooth

shadow_item_cull_mask

The shadow mask. Used with LightOccluder2D to cast shadows. Only occluders with a matching light_mask will cast shadows. See also range_item_cull_mask, which affects which objects can receive the light.

var shadow_item_cull_mask : int = 1

Property Value

int

Remarks

  • void set_item_shadow_cull_mask(int value)
  • int get_item_shadow_cull_mask

Methods

get_height

Qualifiers: const

Returns the light's height, which is used in 2D normal mapping. See height and height.

float get_height

set_height(float)

Sets the light's height, which is used in 2D normal mapping. See height and height.

void set_height(float height)

Parameters

height float