Skip to content
Snippets Groups Projects
Commit 087b0a55 authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

feat: #fe announce waves

parent 421f98ef
No related branches found
No related tags found
No related merge requests found
Pipeline #23931 passed with warnings
......@@ -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({
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment