Shell Clean-Up on level changes in Super Kart.
This commit is contained in:
parent
59a5d0606e
commit
391795c6a0
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue