Files
novafarma/src/scenes/BootScene.js
David Kotnik 7264ec6fc0 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.
2026-01-11 20:08:56 +01:00

94 lines
3.6 KiB
JavaScript

// Boot Scene - Inicializacija sistema
class BootScene extends Phaser.Scene {
constructor() {
super({ key: 'BootScene' });
}
preload() {
console.log('🚀 BootScene: Initializing...');
// Loading bar setup
const width = this.cameras.main.width;
const height = this.cameras.main.height;
const progressBar = this.add.graphics();
const progressBox = this.add.graphics();
progressBox.fillStyle(0x222222, 0.8);
progressBox.fillRect(width / 2 - 160, height / 2 - 25, 320, 50);
const loadingText = this.add.text(width / 2, height / 2 - 50, 'Loading...', {
fontFamily: 'Courier New',
fontSize: '20px',
fill: '#ffffff'
});
loadingText.setOrigin(0.5, 0.5);
this.load.on('progress', (value) => {
progressBar.clear();
progressBar.fillStyle(0x00ff41, 1);
progressBar.fillRect(width / 2 - 150, height / 2 - 15, 300 * value, 30);
});
this.load.on('complete', () => {
progressBar.destroy();
progressBox.destroy();
loadingText.destroy();
});
}
create() {
console.log('✅ BootScene: Complete!');
console.log('🎨 Pixel Art Mode: pixelArt=true, roundPixels=true (NEAREST filtering)');
window.gameState.currentScene = 'BootScene';
// Global Constants for Sprites
window.SPRITE_TREE_HEALTHY = 'tree_green_final';
window.SPRITE_TREE_BLUE = 'tree_blue_final';
window.SPRITE_TREE_DEAD = 'tree_dead_final';
window.SPRITE_TREE_DEAD = 'tree_dead_final';
window.SPRITE_TREE_SAPLING = 'tree_sapling';
// 🌍 GLOBAL FLAGS (Story Registry)
if (!window.gameState) window.gameState = {};
window.gameState.story = {
isAmnesiaActive: true,
daysPassed: 0,
parentsGhostFound: false,
introCompleted: false
};
console.log('📜 Story Registry Initialized:', window.gameState.story);
// 🛠️ DEBUG HOOK: Press 'G' for Gallery
// Note: BootScene is very short-lived, so we put this here just in case,
// but typically input listeners are wiped on scene change.
// Better: We rely on PreloadScene to carry us, BUT user asked for BootScene hook.
// Since BootScene auto-transitions in 100ms, user has to be VERY fast or we pause.
// Let's pause auto-transition if user holds G?
// Better: Just check directly.
const keys = this.input.keyboard.createCursorKeys();
// Since we can't reliably catch 'G' in 100ms, let's add it to window and check in PreloadScene?
// Or simply: Add a global listener that persists (if possible), or just scene start.
// Let's make BootScene wait a tiny bit longer or add instruction.
// Actually, user said "V BootScene... dodaj tisti hook".
this.input.keyboard.on('keydown-G', () => {
console.log('🖼️ Gallery Shortcut Detected!');
// Cancel auto transition
this.transitionEvent.remove();
this.scene.start('AssetTestScene');
});
// Debug Text
this.add.text(10, 10, 'Press G for Asset Gallery', { fontSize: '12px', fill: '#00ff00' }).setDepth(1000);
// Takoj po bootu gremo v PreloadScene (razen če G)
this.transitionEvent = this.time.delayedCall(1500, () => {
// Increased delay slightly to 1.5s so user has time to read/press G
// This is Development Mode ONLY tweak
this.scene.start('PreloadScene');
});
}
}