const GameStates = require("GameStates"); cc.Class({ extends: cc.Component, properties: { }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, //0 star 1 redstar 2 ufo 3 stone 4 ice 5 fish 6 drink 7 boom start () { this.main = this.node.parent.parent.getComponent('GameMode') var speedArr = [3.96,3.60,3.27,2.98,2.71,2.46,2.24,2.03,1.85,1.68] var speed = this.main.speedRate*(speedArr[GameStates.levelNum-1]+1) if(this.node.name == 'tool_Stone') speed = this.main.iceSpeedRate*this.main.speedRate*(speedArr[GameStates.levelNum-1]+1) this.node.runAction(cc.moveBy(speed,0,-2000))//下落速度 if(this.node.name == 'tool_Star' || this.node.name == 'tool_RedStar'){ this.node.runAction(cc.repeatForever(cc.rotateBy(5,360))) } else if(this.node.name == 'tool_Stone'){ this.node.runAction(cc.repeatForever(cc.rotateBy(4.5,360))) } else if(this.node.name == 'tool_Ufo'){ } else{ this.node.runAction(cc.repeatForever(cc.rotateBy(4,360))) } }, onCollisionEnter: function (other, self) { switch (this.node.index) { case 0: if(!this.main.isUsingTool) this.main.getTool1 ++ this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('xingxing',1) this.main.addScore(1) this.main.addTarget() break; case 1: if(!this.main.isUsingTool) this.main.getTool2Rule2 ++ this.main.getTool2Rule4 ++ this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('xingxing',1) this.main.addScore(2) this.main.addTarget() break; case 2: if(!this.main.isUsingTool) this.main.getTool3 ++ this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('xingxing',1) this.main.addScore(3) this.main.addTarget() break; case 3: if(!this.main.isUsingTool) this.main.getTool4 ++ this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('yunshi',1) if(other.node.name=='Player'){ this.main.loseLife() } else{ self.node.destroy() } break; case 4: this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('xingxing',1) this.main.useIce() break; case 5: this.main.showDefence() break; case 6: this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('cat',1) this.main.addLife() break; default: this.main.playerAnimation.getComponent(dragonBones.ArmatureDisplay).playAnimation('xingxing',1) this.main.useBoom() break; } self.node.destroy() }, update (dt) { if(this.node.y