Files
novafarma/old_logic/src_backup_1768938138/scenes/DemoSceneEnhanced.js
2026-01-21 01:08:21 +01:00

129 lines
4.5 KiB
JavaScript

/**
* DemoSceneEnhanced.js
* ═══════════════════════════════════════════════════════════════
* 🎮 MINIMAL TILED MODE - No sprites, just intro text
* ═══════════════════════════════════════════════════════════════
* User will add all content via Tiled Editor
*/
class DemoSceneEnhanced extends Phaser.Scene {
constructor() {
super({ key: 'DemoSceneEnhanced' });
}
preload() {
console.log('🎮 DemoSceneEnhanced: MINIMAL MODE - No sprites, just intro!');
// ═══════════════════════════════════════════════════════════════
// 🎮 TILED WORKFLOW MODE - NO SPRITE LOADING!
// ═══════════════════════════════════════════════════════════════
// User will add all content via Tiled maps
// This scene just shows intro text and empty world
console.log('✅ No assets to load - Tiled mode!');
}
create() {
console.log('🎮 DemoSceneEnhanced: Creating EMPTY world + Intro text...');
// Setup empty world
this.cameras.main.setBackgroundColor('#2a2a2a'); // Dark grey background
this.cameras.main.setBounds(0, 0, 800, 600);
this.physics.world.setBounds(0, 0, 800, 600);
this.showIntroText();
console.log('✅ Empty world ready - Add content via Tiled!');
}
showIntroText() {
// ═══════════════════════════════════════════════════════════════
// 📖 INTRO TEXT - Game Story
// ═══════════════════════════════════════════════════════════════
const centerX = 400;
const centerY = 300;
// Title
this.add.text(centerX, 100, 'MRTVA DOLINA', {
fontSize: '48px',
color: '#ff0000',
fontStyle: 'bold',
stroke: '#000000',
strokeThickness: 4
}).setOrigin(0.5);
// Subtitle
this.add.text(centerX, 160, 'Krvava Žetev', {
fontSize: '32px',
color: '#990000',
fontStyle: 'italic'
}).setOrigin(0.5);
// Story intro
const storyText = [
'Svet je padel v kaos.',
'Zombiji hodijo med ruševinami.',
'Ti si Kai - preživeli najstnik.',
'',
'Iščeš svojo sestro Ano...',
'',
'Dobrodošel v Mrtvi Dolini.'
].join('\n');
this.add.text(centerX, centerY, storyText, {
fontSize: '20px',
color: '#ffffff',
align: 'center',
lineSpacing: 10,
backgroundColor: '#00000088',
padding: { x: 20, y: 20 }
}).setOrigin(0.5);
// Instructions
this.add.text(centerX, 520, '[Press SPACE or click to start]', {
fontSize: '18px',
color: '#00ff00',
fontStyle: 'italic'
}).setOrigin(0.5);
// Click to start
this.input.keyboard.once('keydown-SPACE', () => {
this.startGame();
});
this.input.once('pointerdown', () => {
this.startGame();
});
}
startGame() {
console.log('🎮 Starting game...');
// Clear intro
this.children.removeAll();
// Show "Add content via Tiled" message
const centerX = 400;
const centerY = 300;
this.add.text(centerX, centerY, 'Empty World\n\nAdd content via Tiled Editor\n\n(Press ESC to see intro again)', {
fontSize: '24px',
color: '#ffffff',
align: 'center',
lineSpacing: 15,
backgroundColor: '#00000088',
padding: { x: 30, y: 30 }
}).setOrigin(0.5);
// ESC to go back to intro
this.input.keyboard.on('keydown-ESC', () => {
this.scene.restart();
});
}
update() {
// Empty - no game loop needed for intro screen
}
}