Archive 17/01/2023.

How to achieve 2d lights blocked by the wall

spwork

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。

Modanung

Maybe this could help you out:

spwork

Finally, it’s succeed.

Modanung

Cool.
Any plans to share that code?

spwork

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.