Skip to content

Commit

Permalink
Colored cutscene text
Browse files Browse the repository at this point in the history
  • Loading branch information
Matojeje committed Aug 20, 2024
1 parent aa73155 commit 97a32b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 14 additions & 13 deletions src/components/Intermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions src/scenes/GameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 97a32b9

Please sign in to comment.