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

feat: make #fe hud clearer

parent fea3a247
No related branches found
No related tags found
No related merge requests found
...@@ -166,33 +166,30 @@ export default class FightScene extends Phaser.Scene { ...@@ -166,33 +166,30 @@ export default class FightScene extends Phaser.Scene {
} }
initHUD() { initHUD() {
this.hud.score = this.add.text(10, 10, this.score.toString(), { this.hud.score = this.add.text(10, 10, "", {
font: "bold 32px Courier", font: "bold 48px Courier",
color: "lightgreen", color: "lightgreen",
}); });
this.hud.score.setOrigin(0, 0); this.hud.score.setOrigin(0, 0);
this.updateScore(0);
this.hud.health = this.add.text( this.hud.health = this.add.text(this.cameras.main.width - 10, 10, "", {
this.cameras.main.width - 10, font: "bold 48px Courier",
10, color: "orange",
this.health.toString(), });
{
font: "bold 32px Courier",
color: "orange",
},
);
this.hud.health.setOrigin(1, 0); this.hud.health.setOrigin(1, 0);
this.updateHealth(0);
} }
updateScore(delta) { updateScore(delta) {
this.score += delta; this.score += delta;
this.hud.score.text = this.score.toString(); this.hud.score.text = "" + this.score.toString();
} }
updateHealth(delta) { updateHealth(delta) {
this.health += delta; this.health += delta;
this.health = Math.max(this.health, 0); this.health = Math.max(this.health, 0);
this.hud.health.text = this.health.toString(); this.hud.health.text = this.health.toString() + "";
this.checkAlive(); this.checkAlive();
} }
......
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