0 votes

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?

Godot version 3.2.3.stable
in Engine by (158 points)
edited by

1 Answer

+1 vote
Best answer

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.

by (8,546 points)
selected by

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

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

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.