46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
class GameOverText extends Phaser.Text {
|
|
|
|
constructor() {
|
|
super(
|
|
game,
|
|
game.world.width / 2,
|
|
game.world.height / 2 - GameOverText.MOVE_AMOUNT_PX,
|
|
"게임 오버",
|
|
GameOverText.DEFAULT_TEXT_FONT
|
|
);
|
|
// super(game, 600, 300, "게임 오버", GameOverText.DEFAULT_TEXT_FONT);
|
|
|
|
this.anchor.set(0.5);
|
|
this.inputEnabled = false;
|
|
|
|
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
|
|
grd.addColorStop(0, '#FFD68E');
|
|
grd.addColorStop(1, '#B34C00');
|
|
this.fill = grd;
|
|
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
|
this.stroke = '#000';
|
|
this.strokeThickness = 10;
|
|
|
|
|
|
this.alpha = 0;
|
|
let tweenAlpha = game.add.tween(this);
|
|
tweenAlpha.to( { alpha: 1 }, GameOverText.TWEEN_ALPHA_TIME, Phaser.Easing.Linear.None, true);
|
|
|
|
let tweenMove = game.add.tween(this);
|
|
tweenMove.to( { y: game.world.height / 2 }, GameOverText.TWEEN_MOVE_TIME, Phaser.Easing.Bounce.Out, true);
|
|
|
|
game.add.existing(this);
|
|
};
|
|
|
|
}
|
|
|
|
GameOverText.DEFAULT_TEXT_FONT = {
|
|
font: "bold 100px Arial",
|
|
boundsAlignH: "center", // left, center. right
|
|
boundsAlignV: "middle", // top, middle, bottom
|
|
fill: "#fff"
|
|
};
|
|
|
|
GameOverText.MOVE_AMOUNT_PX = 200;
|
|
GameOverText.TWEEN_ALPHA_TIME = 1000;
|
|
GameOverText.TWEEN_MOVE_TIME = 1500; |