I've been working on a way to add fancy dynamic lighting to my current game project and wanted to share my little demo project.
The general idea (put a layer of darkness over everything and then stamp out the light) has been the standard method for quite a while, but I didn't like that this darkness would just lay over everything. So, now it's possible to define where your darkness should be. The rest has already been done before, but as the respective forum in flashgame dojo is no longer available, it doesn't hurt to bring it back up again.
Defined areas of darkness: Create a layer of darkness out of selected Tilemaps, static and animated sprites, but leave out all the transparent parts and areas not covered by the selected items. Useful for building windows.
Light moods: Your darkness can also work as a colored light mood, by turning the scene in red, golden or bluish light. The color and intensity of the darkness can even change over time.
Colored Lights: Your darkness can be illuminated by lights of all colors, and objects within that light cone will receive the respective tint.
Dynamic lighting: Both your light sources and your to-be-lighted objects can move around the screen.
Animated lighting: You want a light source that casts a flickering light like a camp fire? No problem.
Here is a link to the github project.
It might be required to set one or two variables from the flixel base classes from private to public in order for it to work!
(uses flixel dev build 4.0.1)
And here a link directly to the flash build.