var Game = cc.Class({ extends: cc.Component, properties: { Life: cc.Node, AudioMng: cc.Node, Knife: cc.Node, Pan: cc.Node }, statics: { instance: null }, // LIFE-CYCLE CALLBACKS: onLoad () { Game.instance = null this.Life = this.Life.getComponent('Life') this.Knife = this.Knife.getComponent('Knife') this.AudioMng = this.AudioMng.getComponent('AudioMng') this.Life.init() //添加碰撞 var manager = cc.director.getCollisionManager(); manager.enabled = true; // manager.enabledDebugDraw = true; this.node.on('touchstart', (event) => { if(!this.Life.isEnd) { this.Life.minus() this.Knife.shoot() this.AudioMng.playHitWood() } }, this) }, start () { }, // update (dt) {}, });