Hiding objects behind invisible layer

Hi there! I’ve find an interesting game. One thing, that hooked me up was shining on sprite, when the moon is lighting that one. But when sprite is behind wall, shine is hiding, and it looks like it’s hiding behind invisible layer with shape of wall, that hiding the shine but don’t does it with sprite. So, how can I do the same thing? I hope google translator convert my words correctly.

Google translator is not doing a great job, I’m afraid.
I think you are looking for raycast, but I’m not sure.
It sends an invisible line from A to B, and changes variables if an object is on the line or not.