From 97a32b9b2053cbd4059269e415f1c881dd800493 Mon Sep 17 00:00:00 2001 From: Matojeje Date: Tue, 20 Aug 2024 19:35:47 +0200 Subject: [PATCH] Colored cutscene text --- src/components/Intermission.ts | 27 ++++++++++++++------------- src/scenes/GameScene.ts | 2 -- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/components/Intermission.ts b/src/components/Intermission.ts index 628dcdf..9906903 100644 --- a/src/components/Intermission.ts +++ b/src/components/Intermission.ts @@ -23,7 +23,7 @@ export class Intermission extends Phaser.GameObjects.Container { private rect: Phaser.GameObjects.Rectangle; private subtitles: Phaser.GameObjects.Text; - private queuedLines: string[]; + private queuedLines: {text: string; tint?: number}[]; private button: Button; @@ -112,37 +112,37 @@ export class Intermission extends Phaser.GameObjects.Container { case Mode.IntroCutscene1: this.cutscene.setTexture("cutscene_dummy1"); this.queuedLines = [ - "Somewhere in Chocoland", - "What a nice day for a walk.", - "Nothing can go wrong...", + {text:"Somewhere in Chocoland"}, + {text:"What a nice day for a walk.", tint:0xFFF69B}, + {text:"Nothing can go wrong...", tint:0xFFB8AA}, ]; break; case Mode.IntroCutscene2: this.cutscene.setTexture("cutscene_dummy2"); this.queuedLines = [ - "Oh no!", - "Not the mud...!", + {text:"Oh no!", tint:0xFFB8AA}, + {text:"Not the mud...!", tint:0xFFB8AA}, ]; break; case Mode.IntroCutscene3: this.cutscene.setTexture("cutscene_dummy3"); this.queuedLines = [ - "Are you OK?", - "My scales are all dirty.", - "Let's get you cleaned up.", - "(*gasp* A customer!)", + {text:"Are you OK?", tint:0xFFF69B}, + {text:"My scales are all dirty.", tint:0xFFB8AA}, + {text:"Let's get you cleaned up.", tint:0xFFF69B}, + {text:"(*gasp* A customer!)", tint:0xFFD34F}, ]; break; case Mode.NextLevelCutscene: this.cutscene.setTexture("cutscene_dummy4"); - this.queuedLines = ["Congratulations!", "Wow! A new location."]; + this.queuedLines = [{text:"Congratulations!"}, {text:"Wow! A new location."}]; break; case Mode.TheEnd: - this.queuedLines = ["The End"]; + this.queuedLines = [{text:"The End"}]; } // Show or hide elements @@ -175,7 +175,8 @@ export class Intermission extends Phaser.GameObjects.Container { showNextLine() { let line = this.queuedLines.shift(); if (line) { - this.subtitles.setText(line); + this.subtitles.setText(line.text); + this.subtitles.setTint(line.tint ?? 0xffffff); this.subtitles.setVisible(true); this.button.setVisible(true); } diff --git a/src/scenes/GameScene.ts b/src/scenes/GameScene.ts index cca247e..6e12037 100644 --- a/src/scenes/GameScene.ts +++ b/src/scenes/GameScene.ts @@ -1418,8 +1418,6 @@ export class GameScene extends BaseScene { intendedVolume.base *= tween; } - console.debug(tween, intendedVolume) - this.musicBase.setVolume( clamp(intendedVolume.base, 0, 1) * volumeModifier); this.musicDowntime.setVolume(clamp(intendedVolume.downtime, 0, 1) * volumeModifier); this.musicCutscene.setVolume(clamp(intendedVolume.cutscene, 0, 1) * volumeModifier);