Tommy Leung from Ourcade writes: "Are you are making a roguelike or dungeon crawler?
Do you want the player to only see what is visible based on where they are standing?
Where enemies or items behind a wall, in the next room, or around the corner should be hidden until the player has line of sight?
Then what you need is a proper field of view algorithm.
Another alternative is this simpler fog of war effect if you don't need a proper field of view..
In this article, we will go over using the MRPAS algorithm to implement a field of view effect in Phaser 3 with tilemaps."