André Staltz
André Staltz

Reputation: 13994

How to specify the "background" for BlendMode.ADD?

I am developing a flash game entirely in FlashDevelop, i.e., only with AS3 code.

I want to do the following: blend, as ADD (adding their colors), a couple of moving DisplayObjects, such that the blending occurs only between them, and not with anything else in the screen.

With no success, I've tried to do this: insert the moving DisplayObjects in a parent DisplayObject named container with blendMode as ADD, while all the rest of the game has blendMode NORMAL. I've also tried to set the blendMode of the moving DisplayObjects as ADD, with container.blendMode == NORMAL, with also no success.

Adobe's AS3 API mentions that the ADD Blend mode "Adds the values of the constituent colors of the display object to the colors of its background". How to control what this background is?

Upvotes: 0

Views: 862

Answers (1)

umop
umop

Reputation: 2192

The background is anything with a lower depth than the movieclips that you're adding. So, whatever you had addChild()ed before those. It can also be the background color of the movie. Make sure that you are using a background color by using the backgroundColor parameter of the SWF tag (ie. [SWF(backgroundColor="#000000")]).

Everything in your game has to blend somehow with the DisplayObjects behind them, so it's hard to see what you need without seeing your specific example. At first hunch, try ADDing everything together in a single Sprite with a black background and then use BlendMode.LIGHTEN, BlendMode.SCREEN, or BlendMode.OVERLAY for that container Sprite.

Upvotes: 1

Related Questions