学习贪吃蛇JS项目实战笔记3

学习贪吃蛇JS项目实战笔记3

res.   后面跟的文件名,要变成紫色才可以调用,否责报错Uncaught TypeError: Cannot read property 'type' of undefined
cc.   后面也是如此、、、、、切记切记
下面这些语句是和 cocos里面等价的语句可以加强着记忆
事件分发cc.eventManager = cc.director.getEventDispatcher();
音乐播放cc.audioEngine = cc.AudioEngine.getInstance();
cc.audioEngine.end = function(){
    this.stopMusic();
    this.stopAllEffects();
};
纹理加载cc.textureCache = cc.director.getTextureCache();
cc.TextureCache.prototype._addImageAsync = cc.TextureCache.prototype.addImageAsync;
cc.TextureCache.prototype.addImageAsync = function(url, cb, target) {
    var localTex = null;
    cc.loader.loadImg(url, function(err, tex) {
        if (err) tex = null;
        if (cb) {
            cb.call(target, tex);
        }
        localTex = tex;
    });
    return localTex;
};
帧动画的加载cc.animationCache = cc.AnimationCache.getInstance();
cc.spriteFrameCache = cc.SpriteFrameCache.getInstance();
粒子效果cc.plistParser = cc.PlistParser.getInstance();
文件操作,类cc.fileUtils = cc.FileUtils.getInstance();
cc.fileUtils.setPopupNotify(false);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值