cocos2D-x-新知识
来源:互联网 发布:万能摄像头软件下载 编辑:程序博客网 时间:2024/06/16 19:29
start: function () {
var label = this.getComponent(cc.Label);
var text = this.name + ' started';
// Change the text in Label Component
label.string = text;
}
2.上下左右移动事件模版
var Left = cc.moveTo(1,cc.p(-0,0));
var rigth = cc.moveTo(1,cc.p(0,0));
return cc.repeatForever(cc.sequence( Left , rigth ));
3.自定义事件和以前学的小区别
window.GAMEDATA={
USER_CLICK_SHRED_FIWEN:"USER_CLICK_SHRED_FIWEN"
};
cc.eventManager.dispatchCustomEvent(GAMEDATA.USER_CLICK_SHRED_FIWEN,this.node)
cc.eventManager.addCustomListener(GAMEDATA.USER_CLICK_SHRED_FIWEN, this.fiwe.bind(this))
fiwe:function(event){
var data = event.getUserData();
}
4.画布移动事件
update:function(dt){
this.node.x -= this._bug*this._bugs
this.node.y -= this._bugt*this._bugs
var bugPosition = this.node.getPosition()
bugPosition = this.node.parent.convertToWorldSpace(bugPosition)
if(bugPosition.x < 0||bugPosition.x > cc.winSize.width){
this._bug *= -1;
}
if(bugPosition.y < 0||bugPosition.y > cc.winSize.height){
this._bugt *= -1;
}
},
5.计时器
cc.eventManager.addListener(listener, this.node)
- cocos2D-x-新知识
- 新知识
- 新知识
- Cocos2d-x
- cocos2d-x
- cocos2d-x
- cocos2d-x
- cocos2d-x
- cocos2d-x
- cocos2d-x
- cocos2d-x
- Cocos2d-X
- cocos2d-x
- cocos2d-x
- Cocos2d-x
- cocos2D-X
- cocos2d-x
- cocos2d-X
- Python - 数字类型
- July 17th 模拟赛C T1 Gift Solution
- JZOJ 4638 第三条跑道 【NOIP2016提高组A组7.16】
- [NOIP 2015]Day.1 T2 信息传递 【最小环】
- LintCode_401 Kth Smallest Number in Sorted Matrix
- cocos2D-x-新知识
- Java关键字
- NYOJ 组合数问题
- 初识ASP.NET Core 1.0
- 滑动视图和表示图的综合应用
- [leetcode] 342. Power of Four
- [android-x86-6.0-rc1] after start netd - netstat
- 定时器的合并和变速
- Java中IO流的设计模式