0 votes

I'm making a multiplayer 2D game where each person has their own flashlight that they can toggle on and off. I'm trying to make it so that players can't see other player's flashlight light through walls. Right now I'm using light2D nodes set to add for the flashlights and a light2D node set to mask for the line of sight.

Here is an image I will use to describe the issue better:
A Screenshot from my game showing the bug
The player character is colored red. The flashlight of the player directly above the red player is showing correctly, as the red player cannot see it's flashlight light when it goes behind the wall. It is working incorrectly for the 3rd player in the center of the circle-ish walls, as the red player can see the entirety of the flashlight.

Right now it is set up so that all of the lights are on the same cull layer with the LOS (line of sight) node on a higher z-index with the shadow color set to the background color. I have tried using a CanvasModulate node with the LOS, but that didn't work and broke the entire LOS system entirely. Any help would be much appreciated.

in Engine by (12 points)

Please log in or register to answer this question.

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.