0 votes

hi, i am new to godot and i need some help.

the game is a 2d side scroller game.

my character carries a torch the map is dark by a canvas modular node and in the map there is an item that i can pick up when i collide with. i want when this item gets picked up the energy parameter of the light2d on the torch to increase and show more of the map.

thanks in advance for help.

Godot version 3.5
in Engine by (12 points)

1 Answer

+1 vote

Since energy is just a property of a Light2D node, if you have a valid reference to the node you can change it like this:

$Light2D.energy = 2.0 # set the value to twice the default

The above assumes you have a Light2D node called Light2D as a direct child of the node containing the above code. If that doesn't match your scene setup, you may have to season to taste to get a reference to your node.

by (13,810 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.