I thought it may be interesting to go over how we did the night vision level in Outpost ( Yeah slight spoiler I know, level 3 uses a night vision effect, there I've said it and spoilt it for you. I also spoilt it for you if you saw our halloween post ).
The way we store the levels is slightly weird, I've touched on it in an earlier post, but to go over it quickly we use the Flash IDE and shove the different layers in movieclips ( Such as the floor, the walls, shadows etc. ). The plus side of this ( There are many to be honest ) is that we can just use the AdjustColor filter and grey scale our tiles.
We already use a vignette in the game, it just creates creepyness and brings focus to the centre of the screen, where the player sprite is. For the night vision level we add another much tighter one to create the impression of a much reduced field of view. This has another cheeky little bonus, which we'll come to.
Next up to enforce the effect is a static animation. Use a noise filter in your usual art package, import it into Flash as a mc. Rotate it around so you have 4 different frames of "Animation" and that's it. On top of that we drop a simple green rectangle and use the Overlay blendMode, and hey presto, our grey scale tiles are now looking pretty damn green.
You may be thinking this is costly CPU wise, but this is where our tighter vignette comes into it, we only have to run these costly items at a reduced size ( Only 320x320 rather than the full screen size of 640x480 ).
Next up, the lights. We have a nice light movieclip which we use on the other levels, I just duplicate this over and over so the intensity is really increased ( BlendMode.ADD is the daddy for things like this, I'd use it on everything if I could. Some past games I have ).
Finally the anamorphic lens flares. They're just so sexy and may be over used in AAA games, but still seem quite rare in Flash. It's just a nice subtle effect and really easy to do.
In Flash just create a straight forward gradient, rather like this one.
In real life you'd alpha out the ends so it fades to nothing on both sides, but I thought it was clearer like this. Convert it to a mc, and blur the crap out of it, with more blur on the x. Convert that to a bitmap and you've got,
It's blurred out to almost nothing, but we're going to use ADD and it'll be on a transparent background ( Plus we're going for subtle ).
In terms of code it's a distance to player check. As the player gets closer we increase the alpha, and when the player moves away we drop it back down.
Again you'd think that running alpha on a 640px wide image would hurt the performance, but Flash seems to be able to cope with it fine, and the lights are spread out where we can, so there's never a silly amount of them running at once.
This new blog software puts the authors name under the heading, but I like to finish off with my name like I'm signing off, so it looks silly doesn't it.