msmshazan
Thanks. Is there a way to programmatically create lightmaps.
Yes.
There is no one "right" way to do it, but I think the simplest option would be to raytrace them.
For each pixel of your lightmap:
For each light:
Trace a ray from the pixel to the light
If you didn't hit anything:
Add the light color (attenuated by distance) to the pixel.
The result is your lighting buffer, which you can then blend in.
Trace against the bounding boxes of sprites, and then against their pixels (treat each pixel as a box) only if you hit the box.
This is not completely accurate, but is usually good enough. (And let's face it: *nothing* in 2D rendering is accurate.) You can (and probably should) blur the result slightly to smooth out the edges.
That gets you direct lighting. Indirect / bounce lighting is also possible: basically, in addition to tracing to the light, trace a bunch of rays in all directions. When those rays hit something, check whether *that* pixel is lit, and if so add a percentage of that lighting to the original. (This is all much easier in 3D where you know the normal vectors on everything.)
Indirect lighting is going to be slow, so better to precompute rather than calculating at runtime.