popraven novi npc

This commit is contained in:
2025-12-08 17:09:52 +01:00
parent 81a7895c10
commit abc536fea1
17 changed files with 149 additions and 58 deletions

View File

@@ -63,24 +63,25 @@ class GameScene extends Phaser.Scene {
// CITY CONTENT: Ruins, Chests, Spawners
console.log('🏚️ Generating City Content...');
// DISABLED - City structures removed for cleaner gameplay
// Main Ruins
this.terrainSystem.placeStructure(55, 55, 'ruin');
this.terrainSystem.placeStructure(65, 65, 'ruin');
this.terrainSystem.placeStructure(75, 75, 'ruin');
this.terrainSystem.placeStructure(60, 70, 'ruin');
this.terrainSystem.placeStructure(70, 60, 'ruin');
// this.terrainSystem.placeStructure(55, 55, 'ruin');
// this.terrainSystem.placeStructure(65, 65, 'ruin');
// this.terrainSystem.placeStructure(75, 75, 'ruin');
// this.terrainSystem.placeStructure(60, 70, 'ruin');
// this.terrainSystem.placeStructure(70, 60, 'ruin');
// Arena (Boss battle area)
this.terrainSystem.placeStructure(75, 55, 'arena');
// this.terrainSystem.placeStructure(75, 55, 'arena');
// Treasure Chests (scattered in ruins)
this.terrainSystem.placeStructure(56, 56, 'chest');
this.terrainSystem.placeStructure(66, 66, 'chest');
this.terrainSystem.placeStructure(76, 76, 'chest');
// this.terrainSystem.placeStructure(56, 56, 'chest');
// this.terrainSystem.placeStructure(66, 66, 'chest');
// this.terrainSystem.placeStructure(76, 76, 'chest');
// Zombie Spawners (in city)
this.terrainSystem.placeStructure(58, 68, 'spawner');
this.terrainSystem.placeStructure(72, 62, 'spawner');
// this.terrainSystem.placeStructure(58, 68, 'spawner');
// this.terrainSystem.placeStructure(72, 62, 'spawner');
// CESTE (ROADS) - povezava med farmo (20,20) in mestom (65,65)
console.log('🛣️ Building Roads...');
@@ -183,7 +184,7 @@ class GameScene extends Phaser.Scene {
console.log('🏭 Initializing Workstation System...');
this.workstationSystem = new WorkstationSystem(this);
// ELITE ZOMBIE v City območju (samo 1 za testiranje)
// ELITE ZOMBIE v City območju (1x za testiranje)
console.log('👹 Spawning ELITE ZOMBIE in City...');
const eliteX = Phaser.Math.Between(50, 80); // City area
const eliteY = Phaser.Math.Between(50, 80);
@@ -195,13 +196,12 @@ class GameScene extends Phaser.Scene {
this.npcs.push(new NPC(this, 60, 20, this.terrainOffsetX, this.terrainOffsetY, 'troll')); // Forest
this.npcs.push(new NPC(this, 70, 70, this.terrainOffsetX, this.terrainOffsetY, 'elf')); // City
// ANIMALS
// ANIMALS (Peaceful + Mutated)
console.log('🐄 Spawning ANIMALS...');
this.npcs.push(new NPC(this, 22, 22, this.terrainOffsetX, this.terrainOffsetY, 'cow'));
this.npcs.push(new NPC(this, 24, 20, this.terrainOffsetX, this.terrainOffsetY, 'chicken'));
this.npcs.push(new NPC(this, 25, 23, this.terrainOffsetX, this.terrainOffsetY, 'chicken'));
// Mutated
this.npcs.push(new NPC(this, 62, 22, this.terrainOffsetX, this.terrainOffsetY, 'cow_mutant')); // In Forest
this.npcs.push(new NPC(this, 62, 22, this.terrainOffsetX, this.terrainOffsetY, 'cow_mutant')); // Aggressive mutant
// Easter Egg: Broken Scooter
console.log('🛵 Spawning Scooter Easter Egg...');
@@ -213,22 +213,22 @@ class GameScene extends Phaser.Scene {
console.log('👹 Creating Zombie Spawners...');
this.spawners = [];
// City spawners (3 spawners around city)
this.spawners.push(new ZombieSpawner(this, 55, 55, 5, 2, 25000)); // NW
this.spawners.push(new ZombieSpawner(this, 75, 55, 5, 2, 25000)); // NE
this.spawners.push(new ZombieSpawner(this, 65, 75, 5, 3, 20000)); // South (more zombies, faster)
// DISABLED - Too many zombies for testing
// this.spawners.push(new ZombieSpawner(this, 55, 55, 5, 2, 25000)); // NW
// this.spawners.push(new ZombieSpawner(this, 75, 55, 5, 2, 25000)); // NE
// this.spawners.push(new ZombieSpawner(this, 65, 75, 5, 3, 20000)); // South
// LOOT CHESTS
console.log('📦 Placing Loot Chests...');
this.chests = [];
// Farm Starter Chest (near spawn)
// Farm Starter Chest ONLY (near spawn)
this.chests.push(new LootChest(this, 28, 28, 'farm_starter'));
// City Chests (3 chests in city)
this.chests.push(new LootChest(this, 60, 60, 'city'));
this.chests.push(new LootChest(this, 70, 60, 'city'));
this.chests.push(new LootChest(this, 65, 70, 'elite'));
// DISABLED - City chests removed for cleaner gameplay
// this.chests.push(new LootChest(this, 60, 60, 'city'));
// this.chests.push(new LootChest(this, 70, 60, 'city'));
// this.chests.push(new LootChest(this, 65, 70, 'elite'));
// SIGNPOSTS/NAVIGATION
console.log('🪧 Adding Signposts...');

View File

@@ -52,6 +52,16 @@ class PreloadScene extends Phaser.Scene {
this.load.image('flowers_new', 'assets/flowers_new.png');
this.load.image('merchant_new', 'assets/merchant_new.png');
this.load.image('elite_zombie', 'assets/elite_zombie.png');
// AI-Generated NPC Sprites (with cache-busting)
const cacheBust = Date.now();
this.load.image('cow', `assets/cow.png?v=${cacheBust}`);
this.load.image('chicken', `assets/chicken.png?v=${cacheBust}`);
this.load.image('troll', `assets/troll.png?v=${cacheBust}`);
this.load.image('elf', `assets/elf.png?v=${cacheBust}`);
this.load.image('villager', `assets/villager.png?v=${cacheBust}`);
this.load.image('cow_mutant', `assets/cow_mutant.png?v=${cacheBust}`);
this.load.image('hill_sprite', 'assets/hill_sprite.png');
this.load.image('fence', 'assets/fence.png');
this.load.image('gravestone', 'assets/gravestone.png');

View File

@@ -474,15 +474,19 @@ class UIScene extends Phaser.Scene {
}
selectSlot(index) {
// Deselect current
if (this.inventorySlots[this.selectedSlot]) {
this.drawSlot(this.inventorySlots[this.selectedSlot], false);
// Deselect ALL slots first
for (let i = 0; i < this.inventorySlots.length; i++) {
if (this.inventorySlots[i]) {
this.drawSlot(this.inventorySlots[i], false);
}
}
this.selectedSlot = index;
// Select new
this.drawSlot(this.inventorySlots[this.selectedSlot], true);
if (this.inventorySlots[this.selectedSlot]) {
this.drawSlot(this.inventorySlots[this.selectedSlot], true);
}
}
updateInventory(slots) {
@@ -1514,4 +1518,27 @@ class UIScene extends Phaser.Scene {
hideOxygen() {
if (this.oxygenContainer) this.oxygenContainer.setVisible(false);
}
showFloatingText(data) {
const text = this.add.text(data.x, data.y, data.text, {
fontSize: '16px',
color: data.color || '#FFFFFF',
fontStyle: 'bold',
stroke: '#000000',
strokeThickness: 3
});
text.setOrigin(0.5);
text.setDepth(10000);
text.setScrollFactor(1);
// Animate upward and fade
this.tweens.add({
targets: text,
y: text.y - 50,
alpha: 0,
duration: 1500,
ease: 'Power2',
onComplete: () => text.destroy()
});
}
}