test
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user