This commit is contained in:
2025-12-14 12:36:46 +01:00
parent 0131f1490f
commit c3dd39e1a6
6 changed files with 1105 additions and 4 deletions

View File

@@ -127,6 +127,31 @@ const CRAFTING_RECIPES = {
result: { item: 'furnace', amount: 1 },
category: 'workstation',
description: 'Smelts ores into bars.'
},
// ==================================
// CUSTOM RECIPES (NEW!)
// ==================================
'lesena_ograda': {
id: 'lesena_ograda',
name: 'Lesena Ograda',
ingredients: [
{ item: 'wood', amount: 2 }
],
result: { item: 'lesena_ograda', amount: 5 },
category: 'buildings',
description: 'Lesena ograja za zaščito farme.'
},
'sekira_osnovna': {
id: 'sekira_osnovna',
name: 'Osnovna Sekira',
ingredients: [
{ item: 'wood', amount: 3 },
{ item: 'stone', amount: 2 }
],
result: { item: 'sekira_osnovna', amount: 1 },
category: 'tools',
description: 'Osnovno orodje za sekanje dreves.'
}
};

View File

@@ -222,9 +222,10 @@ class Player {
}
update(delta) {
if (this.isMoving) {
this.updateDepth();
}
// NOTE: updateDepth() disabled - using sortableObjects Z-sorting in GameScene
// if (this.isMoving) {
// this.updateDepth();
// }
if (!this.isMoving) {
this.handleInput();
@@ -506,7 +507,8 @@ class Player {
}
});
this.updateDepth();
// NOTE: updateDepth() disabled - using sortableObjects Z-sorting in GameScene
// this.updateDepth();
}
updatePosition() {

View File

@@ -338,6 +338,16 @@ class GameScene extends Phaser.Scene {
console.log('👤 Initializing player...');
this.player = new Player(this, 50, 50, this.terrainOffsetX, this.terrainOffsetY);
// 🎯 SORTABLE OBJECTS GROUP - Za 2.5D Z-Sorting
console.log('🎯 Creating sortableObjects group for Z-sorting...');
this.sortableObjects = this.add.group();
// Dodaj player sprite v sortableObjects
if (this.player && this.player.sprite) {
this.sortableObjects.add(this.player.sprite);
console.log('✅ Player added to sortableObjects');
}
// ALL NPCs REMOVED - Solo farming mode
console.log('🌾 Solo farming mode - no NPCs');
@@ -838,6 +848,20 @@ class GameScene extends Phaser.Scene {
update(time, delta) {
if (this.player) this.player.update(delta);
// 🎯 Z-SORTING: SortableObjects based on Y position
if (this.sortableObjects) {
const children = this.sortableObjects.getChildren();
// Sortiranje po Y koordinati (nižji Y = nižji depth)
children.sort((a, b) => a.y - b.y);
// Nastavi depth glede na vrstni red (index)
children.forEach((obj, index) => {
// Use LAYER_OBJECTS base + index for depth
obj.setDepth(200000 + index);
});
}
// Update Systems
if (this.terrainSystem) this.terrainSystem.update(time, delta); // Water animation!
if (this.statsSystem) this.statsSystem.update(delta);