Ensure hp number display fades in/out

This commit is contained in:
Sirz Benjie 2025-05-27 12:25:58 -05:00
parent 970f6841db
commit 4a0d008887
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -21,7 +21,9 @@ export class PlayerBattleInfo extends BattleInfo {
super(Math.floor(globalScene.game.canvas.width / 6) - 10, -72, true);
this.hpNumbersContainer = globalScene.add.container(-15, 10).setName("container_hp");
this.add(this.hpNumbersContainer);
// hp number container must be beneath the stat container for overlay to display properly
this.addAt(this.hpNumbersContainer, this.getIndex(this.statsContainer));
const expBar = globalScene.add.image(-98, 18, "overlay_exp").setName("overlay_exp").setOrigin(0);
this.add(expBar);
@ -41,16 +43,6 @@ export class PlayerBattleInfo extends BattleInfo {
this.expMaskRect = expMaskRect;
}
/**
* Toggle the stat overlay, ensuring that the hp numbers container is hidden while the stats are visible.
* @param visible - Whether the stats should be visible or not.
*/
override toggleStats(visible: boolean): void {
// Need to make the hp numbers container invisible
this.hpNumbersContainer.setVisible(!visible);
super.toggleStats(visible);
}
override initInfo(pokemon: PlayerPokemon): void {
super.initInfo(pokemon);
this.setHpNumbers(pokemon.hp, pokemon.getMaxHp());