posodobitve
This commit is contained in:
@@ -375,72 +375,79 @@ class PreloadScene extends Phaser.Scene {
|
||||
const width = this.cameras.main.width;
|
||||
const height = this.cameras.main.height;
|
||||
|
||||
// Background for loading screen
|
||||
// Warm background (Stardew Valley style)
|
||||
const bg = this.add.graphics();
|
||||
bg.fillStyle(0x000000, 1);
|
||||
bg.fillStyle(0x2d1b00, 1);
|
||||
bg.fillRect(0, 0, width, height);
|
||||
|
||||
// Styling
|
||||
const primaryColor = 0x00ff41; // Matrix Green
|
||||
const secondaryColor = 0xffffff;
|
||||
|
||||
// Logo / Title
|
||||
const title = this.add.text(width / 2, height / 2 - 80, 'NOVA FARMA', {
|
||||
fontFamily: 'Courier New', fontSize: '32px', fontStyle: 'bold', fill: '#00cc00'
|
||||
// Simple "LOADING" text
|
||||
const title = this.add.text(width / 2, height / 2 - 80, 'LOADING', {
|
||||
fontFamily: 'Georgia, serif',
|
||||
fontSize: '36px',
|
||||
fontStyle: 'bold',
|
||||
fill: '#f4e4c1',
|
||||
stroke: '#2d1b00',
|
||||
strokeThickness: 4
|
||||
}).setOrigin(0.5);
|
||||
|
||||
const tipText = this.add.text(width / 2, height - 50, 'Tip: Zombies drop blueprints for new tech...', {
|
||||
fontFamily: 'monospace', fontSize: '14px', fill: '#888888', fontStyle: 'italic'
|
||||
}).setOrigin(0.5);
|
||||
// Progress Bar container (wooden style)
|
||||
const barWidth = 400;
|
||||
const barHeight = 30;
|
||||
const barX = width / 2 - barWidth / 2;
|
||||
const barY = height / 2;
|
||||
|
||||
// Progress Bar container
|
||||
const progressBox = this.add.graphics();
|
||||
progressBox.fillStyle(0x111111, 0.8);
|
||||
progressBox.fillRoundedRect(width / 2 - 160, height / 2 - 15, 320, 30, 5);
|
||||
progressBox.lineStyle(2, 0x333333, 1);
|
||||
progressBox.strokeRoundedRect(width / 2 - 160, height / 2 - 15, 320, 30, 5);
|
||||
progressBox.fillStyle(0x4a3520, 0.9);
|
||||
progressBox.fillRoundedRect(barX, barY, barWidth, barHeight, 5);
|
||||
progressBox.lineStyle(3, 0xd4a574, 1);
|
||||
progressBox.strokeRoundedRect(barX, barY, barWidth, barHeight, 5);
|
||||
|
||||
const progressBar = this.add.graphics();
|
||||
|
||||
const percentText = this.add.text(width / 2, height / 2, '0%', {
|
||||
font: '16px Courier New',
|
||||
fill: '#ffffff',
|
||||
fontStyle: 'bold'
|
||||
// Zombie sprite walking on the bar
|
||||
const zombie = this.add.text(barX, barY + barHeight / 2, '🧟', {
|
||||
fontSize: '32px'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
const assetLoadingText = this.add.text(width / 2, height / 2 + 30, 'Initializing...', {
|
||||
font: '12px console', fill: '#aaaaaa'
|
||||
// Percentage text
|
||||
const percentText = this.add.text(width / 2, barY + barHeight / 2, '0%', {
|
||||
font: '16px Georgia',
|
||||
fill: '#f4e4c1',
|
||||
fontStyle: 'bold'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
this.load.on('progress', (value) => {
|
||||
percentText.setText(parseInt(value * 100) + '%');
|
||||
progressBar.clear();
|
||||
progressBar.fillStyle(primaryColor, 1);
|
||||
progressBar.fillStyle(0x6b4423, 1);
|
||||
|
||||
// Smooth fill
|
||||
const w = 310 * value;
|
||||
const w = (barWidth - 10) * value;
|
||||
if (w > 0) {
|
||||
progressBar.fillRoundedRect(width / 2 - 155, height / 2 - 10, w, 20, 2);
|
||||
progressBar.fillRoundedRect(barX + 5, barY + 5, w, barHeight - 10, 2);
|
||||
}
|
||||
});
|
||||
|
||||
this.load.on('fileprogress', (file) => {
|
||||
assetLoadingText.setText(`Loading: ${file.key}`);
|
||||
// Move zombie along the bar (moderate speed)
|
||||
const zombieX = barX + (barWidth * value);
|
||||
zombie.setX(zombieX);
|
||||
|
||||
// Gentle bounce animation
|
||||
const bounce = Math.sin(value * 20) * 3;
|
||||
zombie.setY(barY + barHeight / 2 + bounce);
|
||||
});
|
||||
|
||||
this.load.on('complete', () => {
|
||||
// Fade out animation
|
||||
this.tweens.add({
|
||||
targets: [progressBar, progressBox, percentText, assetLoadingText, title, tipText, bg],
|
||||
targets: [progressBar, progressBox, percentText, title, zombie, bg],
|
||||
alpha: 0,
|
||||
duration: 1000,
|
||||
duration: 800,
|
||||
onComplete: () => {
|
||||
progressBar.destroy();
|
||||
progressBox.destroy();
|
||||
percentText.destroy();
|
||||
assetLoadingText.destroy();
|
||||
title.destroy();
|
||||
tipText.destroy();
|
||||
zombie.destroy();
|
||||
bg.destroy();
|
||||
}
|
||||
});
|
||||
@@ -451,60 +458,10 @@ class PreloadScene extends Phaser.Scene {
|
||||
console.log('✅ PreloadScene: Assets loaded!');
|
||||
window.gameState.currentScene = 'PreloadScene';
|
||||
|
||||
const width = this.cameras.main.width;
|
||||
const height = this.cameras.main.height;
|
||||
|
||||
const title = this.add.text(width / 2, height / 2 - 50, 'KRVAVA ŽETEV', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '48px',
|
||||
fill: '#ff0000',
|
||||
fontStyle: 'bold',
|
||||
stroke: '#000000',
|
||||
strokeThickness: 6
|
||||
});
|
||||
title.setOrigin(0.5);
|
||||
|
||||
const subtitle = this.add.text(width / 2, height / 2 + 10, 'Zombie Roots', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '24px',
|
||||
fill: '#00ff41'
|
||||
});
|
||||
subtitle.setOrigin(0.5);
|
||||
|
||||
const instruction = this.add.text(width / 2, height / 2 + 60, 'Press SPACE to start', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '16px',
|
||||
fill: '#888888'
|
||||
});
|
||||
instruction.setOrigin(0.5);
|
||||
|
||||
this.tweens.add({
|
||||
targets: instruction,
|
||||
alpha: 0.3,
|
||||
duration: 800,
|
||||
yoyo: true,
|
||||
repeat: -1
|
||||
});
|
||||
|
||||
const startGame = () => {
|
||||
// Go directly to main menu (StoryScene)
|
||||
this.time.delayedCall(500, () => {
|
||||
console.log('🎮 Starting StoryScene...');
|
||||
this.input.keyboard.off('keydown');
|
||||
this.input.off('pointerdown');
|
||||
this.scene.start('StoryScene');
|
||||
};
|
||||
|
||||
this.time.delayedCall(3000, () => {
|
||||
startGame();
|
||||
});
|
||||
|
||||
this.input.keyboard.on('keydown', (event) => {
|
||||
if (event.code === 'Space' || event.code === 'Enter') {
|
||||
startGame();
|
||||
}
|
||||
});
|
||||
|
||||
this.input.on('pointerdown', () => {
|
||||
startGame();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user