2D shader to affect lights based on distance and

I've been struggling with this problem for a few weeks (mainly because I'm very new to shaders), but I have an angled camera for my 2D game that uses lights.

I saw this link about the & # 39; 3D light simulation & # 39; and I asked myself how the person responsible for the shading was written. I'm in Godot, which uses its own shading language. I just need a way to compare the values ​​of y from the light source and the sprite. Any help would be really appreciated!