feat: complete Style 32 overhaul & Tiled integration fix
- Enforced 'Style 32 - Dark Chibi Vector' for all ground assets. - Fixed critical Prologue-to-Game crash (function renaming). - Implemented Tiled JSON/TMX auto-conversion. - Updated Asset Manager to visualize 1800+ assets. - Cleaned up project structure (new assets/grounds folder). - Auto-Ground logic added to GameScene.js.
This commit is contained in:
@@ -9,11 +9,25 @@ class PreloadScene extends Phaser.Scene {
|
||||
|
||||
this.createLoadingBar();
|
||||
|
||||
// 🛠️ Asset Fix: Create placeholder for missing particles
|
||||
// This prevents crash in WaterPhysicsSystem if 'particle_white' is used before load
|
||||
if (!this.textures.exists('particle_white')) {
|
||||
const g = this.make.graphics({ x: 0, y: 0, add: false });
|
||||
g.fillStyle(0xffffff, 1);
|
||||
g.fillCircle(4, 4, 4);
|
||||
g.generateTexture('particle_white', 8, 8);
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// 🎵 AUDIO PRELOAD - Cinematic Voices
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
this.preloadAudio();
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// 🌍 LOCALIZATION
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
this.load.json('localization', 'assets/localization.json');
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// 🎨 CHARACTER SPRITES - Demo Characters
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
@@ -29,23 +43,50 @@ class PreloadScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
preloadCharacterSprites() {
|
||||
console.log('🎨 Preloading character sprites...');
|
||||
console.log('🎨 Preloading ALL ASSETS from AssetManifest...');
|
||||
|
||||
const basePath = 'assets/references/main_characters/';
|
||||
// Dynamic import logic (requires module system, but we'll use direct reference if global or shim)
|
||||
// Since we are in Setup phase, we assume AssetManifest is loaded via script tag or bundler
|
||||
|
||||
// Kai sprites
|
||||
this.loadImageSafe('kai_idle', basePath + 'kai/animations/idle/kai_idle_frame1.png');
|
||||
this.loadImageSafe('kai_walk', basePath + 'kai/animations/walk/kai_walk_frame1.png');
|
||||
// Check if AssetManifest exists globally or we need to rely on the file we created
|
||||
// For this environment, we'll manually iterate the data structure if it's not imported.
|
||||
// But since we just created src/AssetManifest.js, let's try to assume it's available.
|
||||
|
||||
// Ana sprites
|
||||
this.loadImageSafe('ana_idle', basePath + 'ana/animations/idle/ana_idle_frame1.png');
|
||||
this.loadImageSafe('ana_walk', basePath + 'ana/animations/walk/ana_walk_frame1.png');
|
||||
// NOTE: In standard Phaser/Webpack, we would import { AssetManifest } from '../AssetManifest'.
|
||||
// Here we will inject logic to load it. For now, let's assume we can fetch it or it's hardcoded.
|
||||
|
||||
// Susi (companion)
|
||||
this.loadImageSafe('susi_idle', 'assets/references/companions/susi/animations/idle/susi_idle_frame1.png');
|
||||
this.loadImageSafe('susi_run', 'assets/references/companions/susi/animations/run/susi_run_frame1.png');
|
||||
// Load Manifest Images
|
||||
// Since we are using script tags in index.html, window.AssetManifest is already available!
|
||||
if (window.AssetManifest) {
|
||||
const manifest = window.AssetManifest;
|
||||
|
||||
console.log('🎨 Character sprites queued');
|
||||
console.log(`📦 Loading Asset Manifest (Phased)...`);
|
||||
|
||||
// Iterate over phases (farm, basement_mine, etc.)
|
||||
if (manifest.phases) {
|
||||
Object.keys(manifest.phases).forEach(phaseName => {
|
||||
console.log(`Phase: ${phaseName} - ${manifest.phases[phaseName].length} items`);
|
||||
manifest.phases[phaseName].forEach(img => {
|
||||
this.loadImageSafe(img.key, img.path);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Iterate over spritesheets
|
||||
if (manifest.spritesheets) {
|
||||
manifest.spritesheets.forEach(sheet => {
|
||||
this.load.spritesheet(sheet.key, sheet.path, sheet.frameConfig);
|
||||
});
|
||||
}
|
||||
|
||||
console.log('✅ AssetManifest Queue Complete');
|
||||
|
||||
// 🗺️ LOAD MAP
|
||||
this.load.tilemapTiledJSON('NovaFarma', 'assets/maps/NovaFarma.json');
|
||||
console.log('🗺️ Preloading NovaFarma.json map...');
|
||||
} else {
|
||||
console.error('❌ Critical: window.AssetManifest not found! Check index.html imports.');
|
||||
}
|
||||
}
|
||||
|
||||
loadImageSafe(key, path) {
|
||||
@@ -474,6 +515,23 @@ class PreloadScene extends Phaser.Scene {
|
||||
zombie.destroy();
|
||||
bg.destroy(); // Ensure bg is destroyed here
|
||||
console.log('✅ PreloadScene: Assets loaded!');
|
||||
|
||||
// 🌍 INITIALIZE LOCALIZATION
|
||||
if (!window.i18n) {
|
||||
try {
|
||||
window.i18n = new LocalizationSystem();
|
||||
const locData = this.cache.json.get('localization');
|
||||
if (locData) {
|
||||
window.i18n.setExternalData(locData);
|
||||
console.log('🌍 Localization initialized with external data');
|
||||
} else {
|
||||
console.warn('⚠️ Localization JSON not found in cache');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('❌ Localization init failed:', e);
|
||||
}
|
||||
}
|
||||
|
||||
window.gameState.currentScene = 'PreloadScene';
|
||||
|
||||
// ✅ Starting INTRO SEQUENCE (NEW! Jan 10, 2026)
|
||||
|
||||
Reference in New Issue
Block a user