Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Fog of war

Guest
May 02, 2013 May 02, 2013

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?

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , May 02, 2013 May 02, 2013

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

Translate
Community Expert ,
May 02, 2013 May 02, 2013

you should be able to use alpha tiles if you enable all tiles cacheAsBitamp property.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 02, 2013 May 02, 2013
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines