podobi
This commit is contained in:
@@ -345,6 +345,15 @@ class GameScene extends Phaser.Scene {
|
||||
console.log('📊 Initializing FPS Monitor...');
|
||||
this.fpsMonitor = new FPSMonitor(this);
|
||||
|
||||
// Performance Monitor (Advanced)
|
||||
console.log('⚡ Initializing Performance Monitor...');
|
||||
this.performanceMonitor = new PerformanceMonitor(this);
|
||||
|
||||
// NPC Spawner
|
||||
console.log('🧟 Initializing NPC Spawner...');
|
||||
this.npcSpawner = new NPCSpawner(this);
|
||||
this.npcSpawner.spawnInitialNPCs();
|
||||
|
||||
// Easter Egg: Broken Scooter
|
||||
console.log('🛵 Spawning Scooter Easter Egg...');
|
||||
this.vehicles = [];
|
||||
@@ -608,6 +617,14 @@ class GameScene extends Phaser.Scene {
|
||||
}
|
||||
};
|
||||
|
||||
// TESTNA DREVESA IN KAMNI - Za testiranje
|
||||
console.log('🌳 Adding test trees and rocks near player...');
|
||||
this.terrainSystem.addDecoration(52, 50, 'tree_green');
|
||||
this.terrainSystem.addDecoration(48, 50, 'rock');
|
||||
this.terrainSystem.addDecoration(50, 52, 'tree_oak');
|
||||
this.terrainSystem.addDecoration(50, 48, 'rock_large');
|
||||
console.log('✅ Test decorations added at (50±2, 50±2)');
|
||||
|
||||
// Start Engine
|
||||
this.Antigravity_Start();
|
||||
}
|
||||
@@ -796,6 +813,17 @@ class GameScene extends Phaser.Scene {
|
||||
// FPS Monitor Update
|
||||
if (this.fpsMonitor) this.fpsMonitor.update();
|
||||
|
||||
// Performance Monitor Update
|
||||
if (this.performanceMonitor) this.performanceMonitor.update(delta);
|
||||
|
||||
// NPC Spawner Update
|
||||
if (this.npcSpawner) this.npcSpawner.update(delta);
|
||||
|
||||
// Update NPCs
|
||||
for (const npc of this.npcs) {
|
||||
if (npc.update) npc.update(delta);
|
||||
}
|
||||
|
||||
// Debug Info
|
||||
if (this.player) {
|
||||
const playerPos = this.player.getPosition();
|
||||
|
||||
@@ -21,6 +21,7 @@ class UIScene extends Phaser.Scene {
|
||||
this.createGoldDisplay();
|
||||
this.createVirtualJoystick();
|
||||
this.createClock();
|
||||
this.createMinimap(); // NEW: Mini mapa
|
||||
// this.createDebugInfo();
|
||||
this.createSettingsButton();
|
||||
|
||||
@@ -303,7 +304,7 @@ class UIScene extends Phaser.Scene {
|
||||
console.log(`Crafted ${recipe.name}!`);
|
||||
|
||||
// Sound & Visuals
|
||||
if (this.gameScene.soundManager) this.gameScene.soundManager.playSuccess();
|
||||
if (this.gameScene.soundManager) this.gameScene.soundManager.beepPickup();
|
||||
this.cameras.main.flash(200, 255, 255, 255);
|
||||
|
||||
// Refresh UI
|
||||
@@ -756,6 +757,9 @@ class UIScene extends Phaser.Scene {
|
||||
this.updateResourceDisplay('stone', inv.getItemCount('stone'));
|
||||
this.updateResourceDisplay('iron', inv.getItemCount('iron'));
|
||||
}
|
||||
|
||||
// Update Minimap
|
||||
this.updateMinimap();
|
||||
}
|
||||
|
||||
createTimeControlPanel() {
|
||||
@@ -2253,4 +2257,113 @@ class UIScene extends Phaser.Scene {
|
||||
if (this.farmGoldEarnedText) this.farmGoldEarnedText.setText(`Gold Earned: ${stats.goldEarned || 0}g`);
|
||||
if (this.farmDaysText) this.farmDaysText.setText(`Days Farmed: ${stats.daysFarmed || 0}`);
|
||||
}
|
||||
|
||||
createMinimap() {
|
||||
const size = 150; // Minimap size
|
||||
const x = 20;
|
||||
const y = this.scale.height - size - 80; // Above inventory bar
|
||||
|
||||
// Container
|
||||
this.minimapContainer = this.add.container(x, y);
|
||||
this.minimapContainer.setDepth(1000);
|
||||
|
||||
// Background
|
||||
const bg = this.add.graphics();
|
||||
bg.fillStyle(0x000000, 0.7);
|
||||
bg.fillRect(0, 0, size, size);
|
||||
bg.lineStyle(2, 0x00ff41, 0.8);
|
||||
bg.strokeRect(0, 0, size, size);
|
||||
this.minimapContainer.add(bg);
|
||||
|
||||
// Title
|
||||
const title = this.add.text(size / 2, -15, 'MINIMAP', {
|
||||
fontSize: '12px',
|
||||
fontFamily: 'Courier New',
|
||||
fill: '#00ff41',
|
||||
fontStyle: 'bold'
|
||||
}).setOrigin(0.5);
|
||||
this.minimapContainer.add(title);
|
||||
|
||||
// Minimap graphics (will be updated in update())
|
||||
this.minimapGraphics = this.add.graphics();
|
||||
this.minimapGraphics.setPosition(x, y);
|
||||
this.minimapGraphics.setDepth(1001);
|
||||
|
||||
// Player dot
|
||||
this.minimapPlayerDot = this.add.circle(size / 2, size / 2, 3, 0xffff00);
|
||||
this.minimapContainer.add(this.minimapPlayerDot);
|
||||
|
||||
console.log('🗺️ Minimap created!');
|
||||
}
|
||||
|
||||
updateMinimap() {
|
||||
if (!this.minimapGraphics || !this.gameScene || !this.gameScene.player) return;
|
||||
|
||||
const size = 150;
|
||||
const worldSize = 100; // Assuming 100x100 world
|
||||
const scale = size / worldSize;
|
||||
|
||||
this.minimapGraphics.clear();
|
||||
|
||||
// Get player position
|
||||
const player = this.gameScene.player;
|
||||
const playerGridX = Math.floor(player.gridX || 0);
|
||||
const playerGridY = Math.floor(player.gridY || 0);
|
||||
|
||||
// Draw terrain (simplified)
|
||||
if (this.gameScene.terrainSystem && this.gameScene.terrainSystem.tiles) {
|
||||
const viewRange = 20; // Show 20x20 tiles around player
|
||||
const startX = Math.max(0, playerGridX - viewRange);
|
||||
const endX = Math.min(worldSize, playerGridX + viewRange);
|
||||
const startY = Math.max(0, playerGridY - viewRange);
|
||||
const endY = Math.min(worldSize, playerGridY + viewRange);
|
||||
|
||||
for (let gx = startX; gx < endX; gx++) {
|
||||
for (let gy = startY; gy < endY; gy++) {
|
||||
const tile = this.gameScene.terrainSystem.getTile(gx, gy);
|
||||
if (!tile) continue;
|
||||
|
||||
let color = 0x44aa44; // Default green (grass)
|
||||
if (tile.type === 'water') color = 0x0088ff;
|
||||
else if (tile.type === 'sand') color = 0xffdd88;
|
||||
else if (tile.type === 'stone') color = 0x888888;
|
||||
else if (tile.type === 'farm') color = 0x8B4513; // Brown for farm
|
||||
|
||||
const mx = (gx - playerGridX + viewRange) * (size / (viewRange * 2));
|
||||
const my = (gy - playerGridY + viewRange) * (size / (viewRange * 2));
|
||||
|
||||
this.minimapGraphics.fillStyle(color, 0.8);
|
||||
this.minimapGraphics.fillRect(
|
||||
this.minimapContainer.x + mx,
|
||||
this.minimapContainer.y + my,
|
||||
size / (viewRange * 2),
|
||||
size / (viewRange * 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw NPCs (red dots)
|
||||
if (this.gameScene.npcs) {
|
||||
this.gameScene.npcs.forEach(npc => {
|
||||
const dx = npc.gridX - playerGridX;
|
||||
const dy = npc.gridY - playerGridY;
|
||||
const viewRange = 20;
|
||||
|
||||
if (Math.abs(dx) < viewRange && Math.abs(dy) < viewRange) {
|
||||
const mx = (dx + viewRange) * (size / (viewRange * 2));
|
||||
const my = (dy + viewRange) * (size / (viewRange * 2));
|
||||
|
||||
const color = npc.isTamed ? 0x00ff00 : 0xff0000; // Green if tamed, red if hostile
|
||||
this.minimapGraphics.fillStyle(color, 1);
|
||||
this.minimapGraphics.fillCircle(
|
||||
this.minimapContainer.x + mx,
|
||||
this.minimapContainer.y + my,
|
||||
2
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user