【cocos2dx-js 学习分享 七】游戏遮罩
来源:互联网 发布:浙江中医院事件知乎 编辑:程序博客网 时间:2024/06/05 10:27
//创建游戏遮罩
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,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 3.2 横版过关游戏Brave学习笔记(七)
- cocos2dx Android游戏截屏分享
- 【COCOS2DX-游戏开发之二七】 坐标系(上)
- JS学习(七)
- 【cocos2dx-js】学习资源汇总
- 【COCOS2DX-游戏开发之十七】twitter分享那点事
- cocos2dx游戏demo接入微信分享SDK
- cocos2dx游戏开发学习第一篇
- cocos2dX游戏屏幕适配学习
- cocos2dx游戏开发学习笔记1-基本概念
- cocos2dx游戏开发学习基础(二)
- cocos2dx游戏开发学习笔记(一)
- cocos2dx游戏开发学习笔记(二)
- cocos2dx游戏开发学习笔记(三)
- cocos2dx-js学习笔记、官方tests示例
- JSP学习笔记(七)-----猜数字游戏
- 分享七
- 用nexus搭建maven私服
- Js 动态加载JS CSS
- android sdk manager无法更新
- Android开发:ScrollView嵌套GridView的解决办法
- 草根旺城:人生格言
- 【cocos2dx-js 学习分享 七】游戏遮罩
- SqlBulkCopy 类
- APP在非3.5英寸的屏幕上下黑边的问题
- 服务器宕机问题排除过程笔记
- wireshark解析rtp协议,流媒体中的AMR/H263/H264包的方法
- css背景颜色渐变
- ubuntu安装和查看已安装
- 【Java.Spring.MVC】Controller
- android startService onStartCommand 多次回调