一、创建战争迷雾类:
module gtm {
export class Fog extends egret.DisplayObjectContainer{
public constructor() {
super();
}
private bitmap:egret.Bitmap;
private bgSh:egret.Shape;
private fogLayer:egret.DisplayObjectContainer;
public init(w:number, h:number):void {
this.bitmap = new egret.Bitmap();
this.addChild(this.bitmap);
this.bgSh = new egret.Shape();
this.bgSh.graphics.beginFill(0x000000, 0.7);
this.bgSh.graphics.drawRect(0, 0, w, h); // 创建黑色遮罩覆盖战场
this.bgSh.graphics.endFill();
this.con = new egret.DisplayObjectContainer();
this.con.addChild(this.bgSh);
this.fogLayer = new egret.DisplayObjectContainer();
this.con.addChild(this.fogLayer);
this.texture = RES.getRes("fog_png"); //以人物为中心的圆形视野
}
private con:egret.DisplayObjectContainer;
private bitmaps:egret.Bitmap[] = [];
private texture:egret.Texture;
private getBitmap():egret.Bitmap {
if (this.bitmaps.length) {
ret

本文介绍如何在Egret游戏开发中应用JavaScript技术,实现手机游戏中的战争迷雾效果,通过详细步骤讲解创建战争迷雾类的解决方案。
最低0.47元/天 解锁文章
3391

被折叠的 条评论
为什么被折叠?



