[Bug][Performance] Plug memory leak related to enemy pokemon lingering around (#6083)

Remove animationupdate in sprite cleanupAndComplete
This commit is contained in:
Sirz Benjie 2025-07-11 13:57:19 -06:00 committed by GitHub
parent ca4df7233f
commit edbba6e635
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -880,6 +880,10 @@ export abstract class BattleAnim {
targetSprite.pipelineData["tone"] = [0.0, 0.0, 0.0, 0.0];
targetSprite.setAngle(0);
// Remove animation event listeners to enable sprites to be freed.
userSprite.off("animationupdate");
targetSprite.off("animationupdate");
/**
* This and `targetSpriteToShow` are used to restore context lost
* from the `isOppAnim` swap. Using these references instead of `this.user`