diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index e3d1cc0691a1e36aac78779ddb398e527c6faa89..0ea4f809bb96cdd6b880e023b9dc6ed8785be192 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -200,12 +200,24 @@ export default class FightScene extends Phaser.Scene { ); } + planWaveAnnouncements() { + this.time.delayedCall(0 * 60 * 1000, () => this.hud.announceWave("WAVE 1")); + this.time.delayedCall(3 * 60 * 1000, () => this.hud.announceWave("WAVE 2")); + this.time.delayedCall(6 * 60 * 1000, () => this.hud.announceWave("WAVE 3")); + this.time.delayedCall(9 * 60 * 1000, () => this.hud.announceWave("WAVE 4")); + this.time.delayedCall(12 * 60 * 1000, () => + this.hud.announceWave("FINAL WAVE"), + ); + } + async create(data: { music: Phaser.Sound.BaseSound }) { (this.scene.get("background") as BackgroundScene).atmosphere.play(); this.music = data.music; this.planMusicChanges(); + this.planWaveAnnouncements(); + this.bindPauseShortcut(); this.gameTime = this.time.addEvent({ diff --git a/frontend/src/js/hud.ts b/frontend/src/js/hud.ts index c6e74652b95e27e44facad2704a73d2a4e230799..7b7aee6738c0f3e5c36a691a4feeb2a5c41f4e46 100644 --- a/frontend/src/js/hud.ts +++ b/frontend/src/js/hud.ts @@ -153,6 +153,31 @@ export default class HUD { }); } + announceWave(input: string) { + const text = this.scene.add + .text( + this.scene.cameras.main.width / 2, + this.scene.cameras.main.height / 4, + input, + { + ...this.inputTextStyle(), + color: "white", + }, + ) + .setOrigin(0.5, 0.5) + .setAlpha(0) + .setScale(0); + this.scene.tweens.add({ + targets: text, + scaleX: 1, + scaleY: 1, + alpha: 1, + ease: "Expo", + yoyo: true, + duration: 500, + }); + } + changeFlash(object: Phaser.GameObjects.Text, color: number) { object.setTintFill(color); this.scene.time.delayedCall(100, () => object.clearTint());