Copy link to clipboard
Copied
I have been trying to implement fog of war for a game I'm making. I have tried several approaches but none have turned out successful.
Alpha tiles:
This was the first thing I tried, unfortunately covering the screen in this many tiles all with alpha levels caused too much lag and I abandoned it.
Vector drawings and blend mode:
Next I tried drawing a dark rectangle and Blendmode.ERASE in out the things I want the player to see. With more than a few light sources this becomes laggy and becomes horrible if I apply a blur filter.
Masks:
Finally I tried masks, unfortunately they aren't very flexible(one mask per movieClip and such.) They didn't fit the bill.
Do you have any alternative suggestions/methods to make these work?
Create a new transparent BitmapData , then use copyPixels() or draw() to put your foh on it. Check out http://www.developria.com/2010/02/dealing-with-bitmapdata.html for more info.
Some examples from my blog of working with pixels that you might find useful http://flexdiary.blogspot.com/search/label/BitmapData
Copy link to clipboard
Copied
you should be able to use alpha tiles if you enable all tiles cacheAsBitamp property.
Copy link to clipboard
Copied
Create a new transparent BitmapData , then use copyPixels() or draw() to put your foh on it. Check out http://www.developria.com/2010/02/dealing-with-bitmapdata.html for more info.
Some examples from my blog of working with pixels that you might find useful http://flexdiary.blogspot.com/search/label/BitmapData
Find more inspiration, events, and resources on the new Adobe Community
Explore Now