//需要延时1.9s一下才执行reshuffleGame,发现用scheduleOnce不行,使用下面解决方案
//this.scheduleOnce(this.reshuffleGame(),1.9);
//reshuffleGame();
var self = this;
this.runAction(cc.Sequence.create( cc.DelayTime.create(1.9), cc.CallFunc.create(function () {
self.reshuffleGame();
})));
运行官方demo例子
1浏览器中运行:在js-tests目录下,执行命令cocos run -p web即可
2手机上运行:在js-tests目录下,执行命令cocos run -p android(需要配置好ant等)
cocoscreator自带的引擎源码目录:/Applications/CocosCreator.app/Contents/Resources
在文件jsb_cocos2d.js中对cc.REPEAT_FOREVER的解释
// XXX: This definition is different than cocos2d-html5
// cc.REPEAT_FOREVER = - 1;
// We can't assign -1 to cc.REPEAT_FOREVER, since it will be a very big double value after
// converting it to double by JS_ValueToNumber on android.
// Then cast it to unsigned int, the value will be 0. The schedule will not be able to work.
// I don't know why this occurs only on android.
// So instead of passing -1 to it, I assign it with max value of unsigned int in c++.
cc.REPEAT_FOREVER = 0xffffffff;之前以为cc.REPEAT_FOREVER的值是-1,程序中直接用了,导致的后果是各个平台的不兼容,找这个bug良久。以后还是要用官方的,避免入坑。
打开多个CCC工程:mac平台下使用命令open -n /Application/CocosCreator.app即可