diff --git a/frontend/src/js/clue.ts b/frontend/src/js/clue.ts index 2daf2683cc7bc89599cc16337c24751298a5e762..5e570d5514a82e2a4279d2c6bda2e47bd0b6a088 100644 --- a/frontend/src/js/clue.ts +++ b/frontend/src/js/clue.ts @@ -9,6 +9,8 @@ const BASE_HEIGHT = 25; const ASCENDERS = /[ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhijklstäöüß]/; const DESCENDERS = /[AFHJPQYZÄfghjpqsyzß]/; +const CONCEAL_TINT = 0xaaaaaa; + class Clue extends Phaser.GameObjects.Sprite { word: Types.Word; scene: FightScene; @@ -98,6 +100,14 @@ class Clue extends Phaser.GameObjects.Sprite { onComplete: onComplete, }); } + + uncover() { + this.clearTint(); + } + + conceal() { + this.setTintFill(CONCEAL_TINT); + } } export default Clue; diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index d98100c49f0ede23dc513bad21654d053c99bfac..799bdd4f463306be5c2f7fb08cdc0ae5fb9ec668 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -77,6 +77,8 @@ export default class FightScene extends Phaser.Scene { init() { this.score = 0; this.health = 100; + this.events.on("pause", this.concealClues.bind(this)); + this.events.on("resume", this.uncoverClues.bind(this)); } async create() { @@ -365,4 +367,12 @@ export default class FightScene extends Phaser.Scene { async spawnFoe() { await new Foe(this).initialize(); } + + concealClues() { + this.foes.forEach((foe) => foe.clue.conceal()); + } + + uncoverClues() { + this.foes.forEach((foe) => foe.clue.uncover()); + } }