AS3如何使战争迷雾 [英] AS3 How to make Fog Of War

查看:88
本文介绍了AS3如何使战争迷雾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我已经完成了一个迷宫游戏,一个角色四处走动,收集东西并射击敌人。游戏完全动态制作。我现在想要添加一个战争迷雾,角色只能在某个圆半径上看到他周围的什么。我使用精灵/电影剪辑创建了图像和背景图像。



我最初的想法是在整个地图上创建5 * 5个黑色方块并让它们全部运行一个eventlistener,看看它们是否被击中,如果被击中,则将alpha更改为0。但我认为它可能会因太多EVENT活跃而陷入困境。有没有更好的方法呢?



谢谢。

Hello, I have complete a maze game that a character walks arounds, collects things and shoots enemies. The game is produced entirely dynamically. I now want to add a fog of war where the character can only see whats around him on a certain circle radius. I have created the images and background images using sprites/movie clips.

My original idea was to create 5*5 black squares over the entire map and have them all running an eventlistener to see if they are hit or not and change the alpha to 0 if they are hit. But I think that it might bog down the game with too many EVENTs active. Is there a better way to do this?

Thanks.

推荐答案

mainMovieClip.mask = someCirlcleLightShape;似乎工作得很好。
mainMovieClip.mask=someCirlcleLightShape; seemed to work nicely.


这篇关于AS3如何使战争迷雾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆