how can i set the directionallight energy from script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By flonkopaten
:warning: Old Version Published before Godot 3 was released.

I want to make a fading light on my script, how do i set the light energy with script?

:bust_in_silhouette: Reply From: flonkopaten

I found out myself, this is how i did it.

	var mylight = get_node("../DirectionalLight")
	var energy = mylight.get_parameter(3)
	energy -=0.03
	mylight.set_parameter(3, energy)
:bust_in_silhouette: Reply From: eons

It does not have a setter, it seems so you will have use set_parameter( int variable, float value ) with PARAM_ENERGY as first parameter.

Everything is in http://docs.godotengine.org/en/stable/classes/class_light.html (just lacks of details…)