cocos creator实现的推箱子游戏,含源码和功能;游戏一共有100关卡。pushBox.zip

cocos creator实现的推箱子游戏,含源码和功能;游戏一共有100关卡。r r cc.Class({r extends: cc.Component,r r properties: {r // foo: {r // ATTRIBUTES:r // default: null, // The default value will be used only when the component attachingr // to a node for the first timer // type: cc.SpriteFrame, // optional, default is typeof defaultr // serializable: true, // optional, default is truer // },r // bar: {r // get () {r // return this._bar;r // },r // set (value) {r // this._bar = value;r // },r r starImg : cc.Node,r itemBg : cc.Node,r levelTxt : cc.Node,r r },r r // LIFE-CYCLE CALLBACKS:r r onLoad () {r r },r r start () {r r },r r //-----显示星星数量----- r /**r * @description:显示星星数量r * @param {boolean} isOpen是否开启r * @param {starCount}星星数量r * @param {cc.SpriteAtlas} levelImgAtlas纹理图r * @param {number} level关卡r * @return: r */r showStar : function(isOpen, starCount, levelImgAtlas, level){r this.itemBg.attr({"_level_" : level});r if(isOpen){r this.itemBg.getComponent(cc.Sprite).spriteFrame = levelImgAtlas.getSpriteFrame("pass_bg");r this.starImg.active = true;r this.starImg.getComponent(cc.Sprite).spriteFrame = levelImgAtlas.getSpriteFrame("point" + starCount);r this.levelTxt.opacity = 255;r this.itemBg.getComponent(cc.Button).interactable = true;r }else{r this.itemBg.getComponent(cc.Sprite).spriteFrame = levelImgAtlas.getSpriteFrame("lock");r this.starImg.active = false;r this.levelTxt.opacity = 125;r this.itemBg.getComponent(cc.Button).interactable = false;r }r r this.levelTxt.getComponent(cc.Label).string = level;r },r r //按钮回调函数响应r btnCallBack : function(event, customEventData){r if(this._callfunc){r this._callfunc(this.itemBg._level_);r },r r levelFunc : function(callfunc){r this._callfunc = callfunc;r },r r // update (dt) {},r });
zip 文件大小:763.34KB