How to do body_entered signal in a sprite?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Krasapan

I want to make it so that when the Light2D enters a certain sprite, this sprite becomes visible, and when the light does not entered in the sprite, the sprite becomes invisible (it’s like limiting the player’s view in 5mintokill.io). How can I do that?

:bust_in_silhouette: Reply From: exuin

You don’t need a body_enteredsignal. You can use a Light2D as a mask. If you really want to use a signal you’ll have to make an Area2D and attach it to the sprite.

Ok, but how to use Light2D as a mask and make other objects hide behind the shadows (without hiding scene’s background)?

Krasapan | 2021-01-22 19:42

Check out this demo. Use light layers to selectively hide stuff.

exuin | 2021-01-22 20:38