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;
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;
......@@ -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());
}
}
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