diff --git a/src/main.ts b/src/main.ts index a86b7c2..afdb9b7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,7 @@ import Phaser from 'phaser'; import { gameConfig } from './config'; -new Phaser.Game(gameConfig); +const game = new Phaser.Game(gameConfig); + +// Expose for debug console access +(window as unknown as Record).__game = game; diff --git a/src/scenes/GameScene.ts b/src/scenes/GameScene.ts index 6ad5ecf..51d80b1 100644 --- a/src/scenes/GameScene.ts +++ b/src/scenes/GameScene.ts @@ -247,10 +247,15 @@ export class GameScene extends Phaser.Scene { // 11. Launch UIScene overlay this.scene.launch('UIScene'); - // Transition from Awakening to Exploration after a moment + // Transition from Awakening to Exploration after a moment this.time.delayedCall(500, () => { advancePhase(this.runState); // Awakening → Exploration }); + + // Debug: expose kill method for testing death cycle + (this as unknown as Record).__debugKill = () => { + Health.current[this.playerEid] = 0; + }; } /** Give the player their school's starting elements */ diff --git a/src/world/minimap.ts b/src/world/minimap.ts index 4c65df6..9e7ec03 100644 --- a/src/world/minimap.ts +++ b/src/world/minimap.ts @@ -82,6 +82,10 @@ export class Minimap { const canvasW = w * scale; const canvasH = h * scale; + // Remove old texture if re-entering scene (run cycle) + if (scene.textures.exists('minimap')) { + scene.textures.remove('minimap'); + } const canvasTexture = scene.textures.createCanvas('minimap', canvasW, canvasH); const ctx = canvasTexture.getContext(); diff --git a/src/world/tilemap.ts b/src/world/tilemap.ts index 8e64d39..5b27448 100644 --- a/src/world/tilemap.ts +++ b/src/world/tilemap.ts @@ -15,7 +15,12 @@ export function createWorldTilemap( const { grid, biome } = worldData; const textureKey = `tileset-${biome.id}`; - // 1. Generate tileset texture + // 1. Remove old texture if re-entering scene (run cycle) + if (scene.textures.exists(textureKey)) { + scene.textures.remove(textureKey); + } + + // 2. Generate tileset texture createTilesetTexture(scene, biome.tiles, biome.tileSize, textureKey); // 2. Create tilemap from grid