diff --git a/assets/Game.fire b/assets/Game.fire index 081fe47..eb04d90 100644 --- a/assets/Game.fire +++ b/assets/Game.fire @@ -162,7 +162,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 876.417708629852 + "z": 539.5338265577053 }, "_scale": { "__type__": "cc.Vec3", diff --git a/assets/Scripts/EnemyShip.ts b/assets/Scripts/EnemyShip.ts index f0b2fdd..909d128 100644 --- a/assets/Scripts/EnemyShip.ts +++ b/assets/Scripts/EnemyShip.ts @@ -13,8 +13,7 @@ const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { - duratrion : number = 0.5; - moveAmountX : number = 50; + duratrion : number = 15; moveAmountY : number = 25; moveEnemy : cc.ActionInterval; @@ -27,9 +26,8 @@ export default class NewClass extends cc.Component { playAnimation : Boolean = true; setMovements() { - var moveLeft = cc.moveBy(this.duratrion, cc.v2(-this.moveAmountX, -this.moveAmountY)).easing(cc.easeCircleActionInOut()); - var moveRight = cc.moveBy(this.duratrion, cc.v2(this.moveAmountX, -this.moveAmountY)).easing(cc.easeCircleActionInOut()); - return cc.repeatForever(cc.sequence(moveLeft, moveRight)); + var moveDown = cc.moveBy(this.duratrion, cc.v2(0, -this.node.parent.getContentSize().height * 0.95)); + this.node.runAction(cc.repeatForever(moveDown)); } shootBullets() { @@ -41,8 +39,7 @@ export default class NewClass extends cc.Component { // LIFE-CYCLE CALLBACKS: onLoad () { - this.moveEnemy = this.setMovements(); - this.node.runAction(this.moveEnemy); + this.scheduleOnce(this.setMovements, 0.1); this.schedule(this.shootBullets, Math.random() * 1 + 1, cc.macro.REPEAT_FOREVER, 0); } @@ -50,6 +47,7 @@ export default class NewClass extends cc.Component { if(otherCollider.name === 'greenbullet') { this.enemyLife--; if(this.enemyLife <= 0 && this.playAnimation) { + this.node.getComponent(cc.Collider).enabled = false; this.node.stopAllActions(); this.playAnimation = false; this.node.getComponent(cc.Animation).play(); diff --git a/assets/Scripts/MoveThruster.ts b/assets/Scripts/MoveThruster.ts index 0f6cd25..a4d49f3 100644 --- a/assets/Scripts/MoveThruster.ts +++ b/assets/Scripts/MoveThruster.ts @@ -30,7 +30,7 @@ export default class NewClass extends cc.Component { update (dt) { this.node.setPosition( this.node.parent.getChildByName('player').position.x, - this.node.parent.getChildByName('player').position.y - 30 + this.node.parent.getChildByName('player').position.y - 50 ); } }