FAZA 0: Initial project setup - Electron + Phaser configuration
This commit is contained in:
48
src/scenes/BootScene.js
Normal file
48
src/scenes/BootScene.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// 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!');
|
||||
window.gameState.currentScene = 'BootScene';
|
||||
|
||||
// Takoj po bootu gremo v PreloadScene
|
||||
this.time.delayedCall(100, () => {
|
||||
this.scene.start('PreloadScene');
|
||||
});
|
||||
}
|
||||
}
|
||||
48
src/scenes/GameScene.js
Normal file
48
src/scenes/GameScene.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// Game Scene - Glavna igralna scena
|
||||
class GameScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'GameScene' });
|
||||
}
|
||||
|
||||
create() {
|
||||
console.log('🎮 GameScene: Initialized!');
|
||||
window.gameState.currentScene = 'GameScene';
|
||||
|
||||
const width = this.cameras.main.width;
|
||||
const height = this.cameras.main.height;
|
||||
|
||||
// Testno besedilo - potrditev da scena deluje
|
||||
const testText = this.add.text(width / 2, height / 2, 'FAZA 0: Setup Complete!\n\nGame Scene Active', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '32px',
|
||||
fill: '#00ff41',
|
||||
align: 'center'
|
||||
});
|
||||
testText.setOrigin(0.5);
|
||||
|
||||
// Debug info
|
||||
const debugText = this.add.text(10, 10, 'FAZA 0 TEST\nElectron + Phaser OK', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '14px',
|
||||
fill: '#ffffff',
|
||||
backgroundColor: '#000000',
|
||||
padding: { x: 10, y: 5 }
|
||||
});
|
||||
|
||||
// FPS counter
|
||||
this.fpsText = this.add.text(10, height - 30, 'FPS: 60', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '14px',
|
||||
fill: '#00ff41'
|
||||
});
|
||||
|
||||
console.log('✅ Faza 0 setup complete - ready for manual testing!');
|
||||
}
|
||||
|
||||
update() {
|
||||
// Update FPS
|
||||
if (this.fpsText) {
|
||||
this.fpsText.setText(`FPS: ${Math.round(this.game.loop.actualFps)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
59
src/scenes/PreloadScene.js
Normal file
59
src/scenes/PreloadScene.js
Normal file
@@ -0,0 +1,59 @@
|
||||
// Preload Scene - Nalaganje assetov
|
||||
class PreloadScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'PreloadScene' });
|
||||
}
|
||||
|
||||
preload() {
|
||||
console.log('📦 PreloadScene: Loading assets...');
|
||||
|
||||
// TODO: Tu bomo nalagali sprite-e, tile-e, audio, itd.
|
||||
// Za fazo 0 pustimo prazno - samo testiramo osnovni setup
|
||||
}
|
||||
|
||||
create() {
|
||||
console.log('✅ PreloadScene: Assets loaded!');
|
||||
window.gameState.currentScene = 'PreloadScene';
|
||||
|
||||
// Prikaz začetnega sporočila
|
||||
const width = this.cameras.main.width;
|
||||
const height = this.cameras.main.height;
|
||||
|
||||
const title = this.add.text(width / 2, height / 2 - 50, 'NOVAFARMA', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '48px',
|
||||
fill: '#00ff41',
|
||||
fontStyle: 'bold'
|
||||
});
|
||||
title.setOrigin(0.5);
|
||||
|
||||
const subtitle = this.add.text(width / 2, height / 2 + 10, '2.5D Isometric Survival Game', {
|
||||
fontFamily: 'Courier New',
|
||||
fontSize: '20px',
|
||||
fill: '#ffffff'
|
||||
});
|
||||
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);
|
||||
|
||||
// Blinking effect
|
||||
this.tweens.add({
|
||||
targets: instruction,
|
||||
alpha: 0.3,
|
||||
duration: 800,
|
||||
yoyo: true,
|
||||
repeat: -1
|
||||
});
|
||||
|
||||
// Pritisk SPACE za začetek igre
|
||||
this.input.keyboard.once('keydown-SPACE', () => {
|
||||
console.log('🎮 Starting GameScene...');
|
||||
this.scene.start('GameScene');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user