From ae795e0e6ef9c2bf2b1ae9653056c4321f384e1f Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 22 Oct 2023 22:45:48 -0400 Subject: [PATCH] Fix enemy trainers staying on screen --- src/battle-phases.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index d57e15587..e4cdccf12 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -401,6 +401,8 @@ export class NextEncounterPhase extends EncounterPhase { this.scene.arenaEnemy.setX(this.scene.arenaNextEnemy.x); this.scene.arenaEnemy.setAlpha(1); this.scene.arenaNextEnemy.setX(this.scene.arenaNextEnemy.x - 300); + if (this.scene.lastEnemyTrainer) + this.scene.lastEnemyTrainer.destroy(); this.doEncounterCommon(); } @@ -521,7 +523,7 @@ export class SwitchBiomePhase extends BattlePhase { this.scene.time.delayedCall(1000, () => this.scene.playBgm()); this.scene.tweens.add({ - targets: [ this.scene.arenaPlayer, this.scene.arenaBgTransition, this.scene.arenaPlayerTransition ], + targets: [ this.scene.arenaPlayer, this.scene.arenaBgTransition, this.scene.arenaPlayerTransition, this.scene.lastEnemyTrainer ], duration: 1000, delay: 1000, ease: 'Sine.easeInOut', @@ -535,6 +537,8 @@ export class SwitchBiomePhase extends BattlePhase { this.scene.arenaNextEnemy.setBiome(this.nextBiome); this.scene.arenaBgTransition.setVisible(false); this.scene.arenaPlayerTransition.setVisible(false); + if (this.scene.lastEnemyTrainer) + this.scene.lastEnemyTrainer.destroy(); this.end(); }