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

feat: #fe simplify hud stats padding

parent b636d01c
No related branches found
No related tags found
No related merge requests found
...@@ -63,32 +63,24 @@ export default class HUD { ...@@ -63,32 +63,24 @@ export default class HUD {
.setOrigin(0.5, 0.5); .setOrigin(0.5, 0.5);
} }
statsTextStyle() { statsTextStyle(): Phaser.Types.GameObjects.Text.TextStyle {
return { return {
...STATS_BASE_TEXT_STYLE, ...STATS_BASE_TEXT_STYLE,
fontSize: this.options.statsFontSize, fontSize: this.options.statsFontSize,
padding: {
x: this.options.statsPadding,
y: this.options.statsPadding,
},
}; };
} }
initScore(scene: Phaser.Scene) { initScore(scene: Phaser.Scene) {
return scene.add return scene.add.text(0, 0, "", this.statsTextStyle()).setOrigin(0, 0);
.text(
this.options.statsPadding,
this.options.statsPadding,
"",
this.statsTextStyle(),
)
.setOrigin(0, 0);
} }
initHealth(scene: Phaser.Scene) { initHealth(scene: Phaser.Scene) {
return scene.add return scene.add
.text( .text(scene.cameras.main.width, 0, "", this.statsTextStyle())
scene.cameras.main.width - this.options.statsPadding,
this.options.statsPadding,
"",
this.statsTextStyle(),
)
.setOrigin(1, 0); .setOrigin(1, 0);
} }
...@@ -96,7 +88,7 @@ export default class HUD { ...@@ -96,7 +88,7 @@ export default class HUD {
return scene.add return scene.add
.text( .text(
scene.cameras.main.width * 0.5, scene.cameras.main.width * 0.5,
this.options.statsPadding, 0,
`${ICONS.CLOCK}1:23.32`, `${ICONS.CLOCK}1:23.32`,
this.statsTextStyle(), this.statsTextStyle(),
) )
...@@ -132,7 +124,7 @@ export default class HUD { ...@@ -132,7 +124,7 @@ export default class HUD {
const text = this.scene.add const text = this.scene.add
.text( .text(
this.scene.cameras.main.width / 2, this.scene.cameras.main.width / 2,
this.scene.cameras.main.height / 2, this.scene.cameras.main.height * this.options.inputPosition,
input, input,
{ {
...INPUT_BASE_TEXT_STYLE, ...INPUT_BASE_TEXT_STYLE,
......
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