Actionscript 3:将 MovieClip 放置在特定层上?
我目前正在开发一款平台游戏,我有一堆不同的图块用来形成我的地图。这些瓷砖的外观差异很大,而且彼此相邻放置,变化非常剧烈,不太美观。我一直在尝试通过以下方式解决此问题:
我有四层,每个要褪色的块有两层。第一层是实际图块(图形)所在的位置。第二层是面具。在遮罩层中,我有一个渐变,它与其他图块遮罩层完全相反(遮罩层 1 向下,遮罩层 2 向上)。然而,我需要能够动态地改变这些,将新的渐变放置在适当的遮罩层中,并将新的图块放置在适当的图形层中。
我在过去一个小时左右的时间里一直在谷歌搜索,试图找到一种方法来定义新的 MovieClip 放置在哪一层,但我找到的只是 setChildIndex,因为一层充当遮罩,所以我可以不用。 Actionscript中是否有这样的功能,或者我是否要手动制作所有图块组合?
感谢您的帮助, -Birjolaxew
I am currently working on a platformer, and I have a bunch of different tiles I use to form my maps with. These tiles are very different in the looks, and placed besides eachother, they give a very sharp change, which is not very visually appealing. I've been trying to fix this in the following way:
I have four layers, two for each block I'm fading. The first layer is where the actual tile, the graphic, is located. The second layer is the mask. In the mask layer, I have a gradient, which is the exact opposite of the other tiles mask layer (Mask layer 1 goes down, mask layer 2 goes up). However, I need to be able to alter those dynamically, place new gradients in the appropriate mask layer, and new tiles in the appropriate graphics layer.
I've been googling around for the last hour or so, attempting to find a way to define which layer a new MovieClip is placed on, but all I've found is setChildIndex, which, since one layer acts as a mask, I can't use. Is there any such function in Actionscript, or am I to make all combinations of tiles by hand?
Thank you for your help,
-Birjolaxew
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用类似此类的内容:
然后您可以创建图层并添加如下内容:
Try using something like this class:
Then you can create your layers and add things like this: