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

feat: #fe conceal clues when game is paused

parent 7e9f6568
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ const BASE_HEIGHT = 25; ...@@ -9,6 +9,8 @@ const BASE_HEIGHT = 25;
const ASCENDERS = /[ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhijklstäöüß]/; const ASCENDERS = /[ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhijklstäöüß]/;
const DESCENDERS = /[AFHJPQYZÄfghjpqsyzß]/; const DESCENDERS = /[AFHJPQYZÄfghjpqsyzß]/;
const CONCEAL_TINT = 0xaaaaaa;
class Clue extends Phaser.GameObjects.Sprite { class Clue extends Phaser.GameObjects.Sprite {
word: Types.Word; word: Types.Word;
scene: FightScene; scene: FightScene;
...@@ -98,6 +100,14 @@ class Clue extends Phaser.GameObjects.Sprite { ...@@ -98,6 +100,14 @@ class Clue extends Phaser.GameObjects.Sprite {
onComplete: onComplete, onComplete: onComplete,
}); });
} }
uncover() {
this.clearTint();
}
conceal() {
this.setTintFill(CONCEAL_TINT);
}
} }
export default Clue; export default Clue;
...@@ -77,6 +77,8 @@ export default class FightScene extends Phaser.Scene { ...@@ -77,6 +77,8 @@ export default class FightScene extends Phaser.Scene {
init() { init() {
this.score = 0; this.score = 0;
this.health = 100; this.health = 100;
this.events.on("pause", this.concealClues.bind(this));
this.events.on("resume", this.uncoverClues.bind(this));
} }
async create() { async create() {
...@@ -365,4 +367,12 @@ export default class FightScene extends Phaser.Scene { ...@@ -365,4 +367,12 @@ export default class FightScene extends Phaser.Scene {
async spawnFoe() { async spawnFoe() {
await new Foe(this).initialize(); await new Foe(this).initialize();
} }
concealClues() {
this.foes.forEach((foe) => foe.clue.conceal());
}
uncoverClues() {
this.foes.forEach((foe) => foe.clue.uncover());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment