Fix scenario where catch stats moves container position can become desynced

pull/21/head
Flashfyre 2024-03-31 12:09:27 -04:00
parent 203ba1646d
commit ec9365a8bf
1 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
private pokemonMoveLabels: Phaser.GameObjects.Text[]; private pokemonMoveLabels: Phaser.GameObjects.Text[];
private initialX: number; private initialX: number;
private movesContainerInitialX: number;
public statsContainer: StatsContainer; public statsContainer: StatsContainer;
@ -38,6 +39,8 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
this.pokemonMovesContainer = this.scene.add.container(6, 14); this.pokemonMovesContainer = this.scene.add.container(6, 14);
this.movesContainerInitialX = this.pokemonMovesContainer.x;
this.pokemonMovesContainers = []; this.pokemonMovesContainers = [];
this.pokemonMoveBgs = []; this.pokemonMoveBgs = [];
this.pokemonMoveLabels = []; this.pokemonMoveLabels = [];
@ -142,7 +145,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
targets: this.pokemonMovesContainer, targets: this.pokemonMovesContainer,
duration: Utils.fixedInt(325), duration: Utils.fixedInt(325),
ease: 'Cubic.easeInOut', ease: 'Cubic.easeInOut',
x: '-=57', x: this.movesContainerInitialX - 57,
onComplete: () => resolve() onComplete: () => resolve()
}); });
} }
@ -168,7 +171,7 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
targets: this.pokemonMovesContainer, targets: this.pokemonMovesContainer,
duration: Utils.fixedInt(750), duration: Utils.fixedInt(750),
ease: 'Cubic.easeInOut', ease: 'Cubic.easeInOut',
x: '+=57' x: this.movesContainerInitialX
}); });
this.scene.tweens.add({ this.scene.tweens.add({