码迷,mamicode.com
首页 > 其他好文 > 详细

egret简单的刮刮乐效果

时间:2020-09-18 02:59:42      阅读:35      评论:0      收藏:0      [点我收藏+]

标签:contain   child   eve   add   width   刮刮乐   graphics   简单   enabled   

private createGameScene1(): void {

var bg = new egret.Shape();
bg.graphics.beginFill(0x0000FF);
bg.graphics.drawRect(0, 0, 480, 800);
bg.graphics.endFill();
this.addChild(bg);


var container: egret.DisplayObjectContainer = new egret.DisplayObjectContainer();
container.width = 300;
container.height = 300;
this.addChild(container);


var shape: egret.Bitmap = new egret.Bitmap();
shape.texture = RES.getRes("bg_jpg");
shape.width = 480;
shape.height = 800;
container.addChild(shape);

this.mask1 = new egret.Shape();
container.addChild(this.mask1);
shape.mask = this.mask1;

this.touchEnabled = true;
this.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.fill, this);
}

private fill(event: egret.TouchEvent) {
this.mask1.graphics.beginFill(0x00FF00);
this.mask1.graphics.drawCircle(event.stageX, event.stageY, 30);
this.mask1.graphics.endFill();
this.mask1.alpha = 0;
// this.mask1.blendMode = egret.BlendMode.ERASE;
}

egret简单的刮刮乐效果

标签:contain   child   eve   add   width   刮刮乐   graphics   简单   enabled   

原文地址:https://www.cnblogs.com/jiajunjie/p/13678665.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!