如何指定“背景”?对于 BlendMode.ADD?
我正在完全使用 FlashDevelop 开发 Flash 游戏,即仅使用 AS3 代码。
我想要执行以下操作:混合,作为 ADD(添加它们的颜色),几个移动的 DisplayObject,这样混合仅发生在它们之间,而不与屏幕中的其他任何内容发生。
但没有成功,我尝试这样做:将移动的 DisplayObject 插入名为容器的父 DisplayObject 中,混合模式为 ADD,而游戏的其余部分都具有混合模式 NORMAL。我还尝试将移动 DisplayObjects 的blendMode 设置为ADD,其中container.blendMode == NORMAL,但也没有成功。
Adobe 的 AS3 API 提到 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
背景是深度低于您要添加的影片剪辑的任何内容。因此,无论您在这些之前使用
addChild()
编辑什么。它也可以是电影的背景颜色。确保您使用 SWF 标记的 backgroundColor 参数(即[SWF(backgroundColor="#000000")]
)来使用背景颜色。游戏中的所有内容都必须以某种方式与它们背后的 DisplayObjects 混合,因此如果不看到具体的示例,就很难看到您需要什么。乍一看,尝试将所有内容添加到具有黑色背景的单个 Sprite 中,然后对该容器 Sprite 使用 BlendMode.LIGHTEN、BlendMode.SCREEN 或 BlendMode.OVERLAY。
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.