// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html cc.Class({ extends: cc.Component, properties: { sp_kill: { default: null, type: cc.Sprite, }, Ani_kill: { default: null, type: cc.Animation, }, // bar: { // get () { // return this._bar; // }, // set (value) { // this._bar = value; // } // }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, playKill(num){ if(num>8){ num=8 } this.sp_kill.spriteFrame = null var self =this cc.loader.loadRes("textures/uires/headshot"+num, cc.SpriteFrame, function (err, res) { if (!err&&self.isValid) { self.sp_kill.spriteFrame = res; } }); cc.gameMgr.playSound("kill"+num) this.Ani_kill.play() } // update (dt) {}, });