Hi! I was bored when my unity update was downloading so I thought I would make a simple example on how to make a decent looking flashlight using only sprites (In essence it's just darkening the screen).
To use follow these steps to get the project to compile correctly (Should be ok if you use a Dark GDK Wizard):
1. Right click your project and select "Properties"
2. Click on the "C/C++" drop down and select "Code Generation".
3. Change Runtime Library to "Multi-Threaded (/MT)"
4. Click on the "Linker" drop down (below the "C/C++" drop down) and select "Input"
5. Add "atls, msvcrt" to the "Ignore Specific Library" box.
6. Then click on System in the "Linker" drop down list and change SubSystem to "Windows".
Then add this line of code before the main loop of your program:
FlashlightSetup ( "Media\\Flashlight2.png", "Media\\Black.png", 1, 2, 3, 245 );
The argument list:
1. The flashlight glow image to be used.
2. The image that will be representing the darkness or unlit places.
3 - 5. The sprites/images to be used.
6. How bright should the flashlight be?
That's it! Enjoy!
Here is screen shot of the flashlight in action:
http://www.freeimagehosting.net/image.php?f058a6b101.png
One problem that I just realized is that you can't use dbText to display text on the screen for the sprites overwrite it. If anyone can find a solution to this I would greatly appreciate it!