0 votes

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

in Engine by (18 points)
edited by

still not working..

what about adding Area2D both on sprite and light?

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

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

1 Answer

+1 vote

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.

by (372 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 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 webmaster@godotengine.org with your username.