get amount of light hitting a sprite/body ?

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

i am trying to make a sprite / body invisible when no light hit it, just like in a dark room, so i am trying to make the sprite invisible by getting the amount of light hitting it, not sure it will work, but i’ll try, but i dont know how to get the amount of light hitting it

still not working…

Phil88n | 2017-06-20 05:32

what about adding Area2D both on sprite and light?

volzhs | 2017-06-20 08:46

What do you mean with “amount of light” and how do you intend to measure it?

eons | 2017-06-20 17:36

Have you tried just changeing the mode of the light source to ‘mask’. This way only things in range can be seen.

ohmi | 2017-06-25 07:35

:bust_in_silhouette: Reply From: rredesigns

Just check the distance from the light source/sources. If you can get the distance for all lamps in the scene it would be pretty easy to check wheter the char is receiving light or not.