cocos2d -js 学习记录

前端之家收集整理的这篇文章主要介绍了cocos2d -js 学习记录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
场景切换 var scene = cc.Scene.create();
var layer = new TestController();
scene.addChild(layer);
var transition = cc.TransitionProgressRadialCCW.create(0.5,scene);
cc.director.runScene(transition);
系统判断 if(cc.sys.os == cc.sys.OS_ANDROID)
{
menuItem.setEnabled( testNames[i].platforms & ( PLATFORM_JSB | PLATFROM_ANDROID ) );
}else if(cc.sys.os == cc.sys.OS_IOS|| cc.sys.os == cc.sys.OS_OSX){
menuItem.setEnabled( testNames[i].platforms & ( PLATFORM_JSB | PLATFROM_IOS) );
}else{
menuItem.setEnabled( testNames[i].platforms & PLATFORM_JSB );
}
系统语言 var currentLanguageType = cc.sys.language;
switch (currentLanguageType) {
case cc.sys.LANGUAGE_ENGLISH:
case cc.sys.LANGUAGE_CHINESE:
监听返回键,menu键 cc.eventManager.addListener({ event:cc.EventListener.KEYBOARD,onKeyReleased: function(keyCode,event){ if (keyCode == cc.KEY.back) { cc.log("return button clicked. keycode:" + keyCode); cc.director.pause(); } else if( keyCode == cc.KEY.menu){ cc.log("return button clicked. keycode:" + keyCode); cc.director.resume(); } } },this);

猜你在找的Cocos2d-x相关文章