Hi,
I’m currently working on a racing game with changing lighting conditions. For the night mode I overlay the scene with a dark bitmap (BitmapData) and now at the postions of the cars I want to cut out some (soft) light spots.
What I’m currently doing is to use the “draw” method to render a “spotlight” bitmap per car into the “night” bitmap. Actually if I have lots of those drawn spotlights, there’s a great loss of performance.
//light = the bitmapData for the light effect
var matrix:Matrix = new Matrix();
for (var n:int=0; n<cars.length; ++n) {
matrix.tx = cars[n].x;
matrix.ty = cars[n].y;
nightBitmapData.draw(light, matrix, null, "lighten");
}
Does anyone has a better and/or faster approach?
Unfortunately “copyChannel” seems to be even slower than “draw” and doesn’t produce the same results…
Thanks in advance,
Bjoern