学习贪吃蛇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);