【cocos2dx-js 学习分享 七】游戏遮罩

【cocos2dx-js 学习分享 七】游戏遮罩,第1张

概述          //创建游戏遮罩         this.clip=new cc.ClippingNode();         this.clip.setInverted(true);         this.clip.setAlphaThreshold(0.0);           this.addChild(this.clip,this.kTagClipNode );       


//创建游戏遮罩
this.clip=new cc.ClipPingNode();
this.clip.setInverted(true);
this.clip.setAlphaThreshold(0.0);
this.addChild(this.clip,this.kTagClipNode );

var back=new cc.Layercolor(cc.color(0,200,0));
this.clip.addChild(back);



var nodef=new cc.Node();
var close=new cc.Sprite(res.Closenormal_png);
nodef.addChild(close);
nodef.setposition(cc.p(size.wIDth/2,size.height/2));
this.clip.setStencil(nodef);

this.tip = new cc.Sprite(res.tip_png);
this.tip.setScale(0.5);
this.tip.setRotation(60);
this.tip.setposition(cc.p(size.wIDth/2-70,size.height/2+50));
this.addChild( this.tip,this.kTagTip);

this.tip.runAction(cc.repeatForever( cc.sequence( cc.scaleBy(0.25,0.95),cc.scaleto(0.25,0.5) ) ));

//触摸开始 ontouchBegan:function (touch,event) { var _size =cc.director.getWinSize(); var point=touch.getLocation(); var rect=cc.rect(_size.wIDth/2-30,_size.height/2-30,60,60); if (cc.rectContainsPoint(rect,point)) { //this.removeChild(this.tip,true); var asd = cc.director.getRunningScene().getChildByTag(1000); asd.removeChild(asd.tip); asd.removeChild(asd.clip); return true; } return false; },

总结

以上是内存溢出为你收集整理的【cocos2dx-js 学习分享 七】游戏遮罩全部内容,希望文章能够帮你解决【cocos2dx-js 学习分享 七】游戏遮罩所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1024938.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存