farma updejt

This commit is contained in:
2025-12-08 01:39:39 +01:00
parent 9c61c3b56d
commit e49f567831
12 changed files with 596 additions and 99 deletions

View File

@@ -131,9 +131,10 @@ class GameScene extends Phaser.Scene {
this.player = new Player(this, 50, 50, this.terrainOffsetX, this.terrainOffsetY);
// Dodaj 3 NPCje (Mixed)
// Dodaj 3 NPCje (Mixed) - Removed zombie
console.log('🧟 Initializing NPCs...');
const npcTypes = ['zombie', 'villager', 'merchant'];
for (let i = 0; i < 3; i++) {
const npcTypes = ['villager', 'merchant'];
for (let i = 0; i < npcTypes.length; i++) {
const randomX = Phaser.Math.Between(40, 60); // Closer to center
const randomY = Phaser.Math.Between(40, 60);
console.log(`👤 Spawning NPC type: ${npcTypes[i]} at (${randomX}, ${randomY})`);
@@ -141,13 +142,15 @@ class GameScene extends Phaser.Scene {
this.npcs.push(npc);
}
// Dodaj 10 dodatnih Zombijev!
// Dodaj 10 dodatnih Zombijev! - REMOVED BY REQUEST
/*
for (let i = 0; i < 10; i++) {
const randomX = Phaser.Math.Between(10, 90);
const randomY = Phaser.Math.Between(10, 90);
const zombie = new NPC(this, randomX, randomY, this.terrainOffsetX, this.terrainOffsetY, 'zombie');
this.npcs.push(zombie);
}
*/
// ELITE ZOMBIES v City območju (65,65 ± 15)
console.log('👹 Spawning ELITE ZOMBIES in City...');
@@ -223,6 +226,9 @@ class GameScene extends Phaser.Scene {
.setScrollFactor(0).setDepth(10000);
console.log('✅ GameScene ready - FAZA 20 (Full Features)!');
// Start Engine
this.Antigravity_Start();
}
setupCamera() {
@@ -512,6 +518,20 @@ class GameScene extends Phaser.Scene {
// ANTIGRAVITY ENGINE UPDATE
// ========================================================
Antigravity_Start() {
console.log('🚀 Starting Antigravity Engine...');
if (window.Antigravity) {
// Camera Setup
if (this.player && this.player.sprite) {
window.Antigravity.Camera.follow(this, this.player.sprite);
}
// ZOOM SETUP - 0.75 za "Open World" pregled
window.Antigravity.Camera.setZoom(this, 0.75);
}
}
Antigravity_Update(delta) {
// Globalni update klic
if (window.Antigravity) {

View File

@@ -15,7 +15,8 @@ class UIScene extends Phaser.Scene {
this.overlayGraphics = this.add.graphics();
this.overlayGraphics.setDepth(-1000); // Behind UI elements
this.createStatusBars();
this.drawUI();
this.createInventoryBar();
this.createGoldDisplay();
this.createVirtualJoystick();
@@ -176,36 +177,37 @@ class UIScene extends Phaser.Scene {
}
}
createStatusBars() {
drawUI() {
const x = 20;
const y = 20;
const width = 200;
const height = 20;
const width = 150; // Zmanjšana širina (300 -> 150)
const height = 15; // Zmanjšana višina (30 -> 15)
const padding = 10;
// Style
const boxStyle = {
fillStyle: { color: 0x000000, alpha: 0.5 },
lineStyle: { width: 2, color: 0xffffff, alpha: 0.8 }
};
// 1. Health Bar
this.add.text(x, y - 5, 'HP', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.healthBar = this.createBar(x + 30, y, width, height, 0xff0000);
this.setBarValue(this.healthBar, 100);
this.healthBar = this.drawBar(x, y, width, height, 0xff0000, 100, 'HP');
// 2. Hunger Bar
this.add.text(x, y + height + padding - 5, 'HUN', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.hungerBar = this.createBar(x + 30, y + height + padding, width, height, 0xff8800);
this.setBarValue(this.hungerBar, 80);
this.hungerBar = this.drawBar(x, y + height + padding, width, height, 0xff8800, 80, 'HUN');
// 3. Thirst Bar
this.add.text(x, y + (height + padding) * 2 - 5, 'H2O', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.thirstBar = this.createBar(x + 30, y + (height + padding) * 2, width, height, 0x0088ff);
this.setBarValue(this.thirstBar, 90);
this.thirstBar = this.drawBar(x, y + (height + padding) * 2, width, height, 0x0088ff, 90, 'H2O');
// 4. XP Bar
this.XPBar = this.drawBar(x, y + (height + padding) * 3, width, height, 0xFFD700, 0, 'XP');
// 5. Level Display
this.LevelDisplay = this.add.text(x, y + (height + padding) * 4, 'LV: 1', {
fontSize: '18px', fontFamily: 'Courier New', fill: '#FFD700', fontStyle: 'bold'
});
}
createBar(x, y, width, height, color) {
drawBar(x, y, width, height, color, initialPercent = 100, label = '') {
// Label
if (label) {
this.add.text(x, y - 12, label, { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
}
// Background
const bg = this.add.graphics();
bg.fillStyle(0x000000, 0.5);
@@ -215,8 +217,11 @@ class UIScene extends Phaser.Scene {
// Fill
const fill = this.add.graphics();
// Initial draw
fill.fillStyle(color, 1);
fill.fillRect(x + 2, y + 2, width - 4, height - 4);
const maxWidth = width - 4;
const currentWidth = (maxWidth * initialPercent) / 100;
fill.fillRect(x + 2, y + 2, currentWidth, height - 4);
return { bg, fill, x, y, width, height, color };
}