Shell Clean-Up on level changes in Super Kart.

This commit is contained in:
Brian Fertig 2026-07-27 17:35:35 -06:00
parent 59a5d0606e
commit 391795c6a0
1 changed files with 4 additions and 0 deletions

View File

@ -519,6 +519,10 @@ export default class SuperKartGame extends Phaser.Scene {
this.backdrop = null; this.backdrop = null;
for (const s of this.worldSprites ?? []) s.sprite.destroy(); for (const s of this.worldSprites ?? []) s.sprite.destroy();
this.worldSprites = null; this.worldSprites = null;
// Dynamic sprites (projectiles: seekers/bolts, dropped oil slicks).
// Must be destroyed here or they persist on-screen into the next level.
for (const s of this.dynamicPool ?? []) s.destroy();
this.dynamicPool = null;
this.playerSprite?.destroy(); this.playerSprite?.destroy();
this.playerSprite = null; this.playerSprite = null;
this.hud?.destroy(); this.hud?.destroy();