How to achieve 2d lights blocked by the wall

I used the alpha blending method to implement 2d lighting, but I don’t know how to achieve the light blocking by the wall. There is no idea. How can I achieve it,Like right。

Maybe this could help you out:


Finally, it’s succeed.


Any plans to share that code?

This is a clumsy implementation, using the CPU to calculate the light length and manually updating the depth map, but it has met my game’s needs.It can throw a brick and attract jade to get a better implement, of 2d lighting.

1 Like