Add: AlienTimer

This commit is contained in:
2018-05-15 16:04:10 +09:00
parent c049ed18ad
commit 3aa2b43b54
6 changed files with 139 additions and 28 deletions
+14 -4
View File
@@ -10,6 +10,9 @@ class Alien extends Phaser.Sprite {
this.initialX = initialX;
this.initialY = initialY;
this.tweenScaleUp = null;
this.tweenScaleDown = null;
this.onGoOnstageFunction = onGoOnstageFunction;
this.onFiredFunction = onFiredFunction;
this.onEscapedFunction = onEscapedFunction;
@@ -55,6 +58,14 @@ class Alien extends Phaser.Sprite {
}
stop() {
this.setActive(false);
this.removeTween();
// if(this.isOnWaitingRoom !== true)
// this.scale.set(0);
}
setActive(isActivated) {
this.isActivated = isActivated;
@@ -66,16 +77,14 @@ class Alien extends Phaser.Sprite {
}
removeTween() {
if(typeof this.tweenScaleUp !== "undefined") {
if(this.tweenScaleUp !== null) {
this.tweenScaleUp.stop();
this.tweenScaleUp = null;
}
if(typeof this.tweenScaleDown !== "undefined") {
if(this.tweenScaleDown !== null) {
this.tweenScaleDown.stop();
this.tweenScaleDown = null;
}
this.scale.set(Alien.ONSTAGE_MIN_SCALE);
}
goWaitingRoom() {
@@ -117,6 +126,7 @@ class Alien extends Phaser.Sprite {
// }
this.tint = 0xffffff;
this.scale.set(Alien.ONSTAGE_MIN_SCALE);
// start scale tween animation
this.removeTween();