Recently, I've decided to put light effects in my game, so, I've made a layer with a black background, and put some elements in it with the "Destination out" effect to do the light effects. But of course, the light effects go over everything, including walls, and I wanted to change that, at least with walls, so the player can't see what's on the rooms except on the room he's at.
After some hard thinking, instead of the player having a "cone of light", I've decided to changed to 13 lines, all following the mouse, but each with a sligthly different angle. And, when it collides with the walls, it changes it's size, if it collides with a vertical platform, I use a certain formula, if it's a horizontal one, another formula, and if it's not colliding with any of the walls, it goes to it's original size.
It works well, but I'm having trouble whenever you're looking from the side of a horizontal platform or looking to the top/bottom of a vertical platform.
I need help figuring out a way to fix the above error or to change how the light effects works at all!