feat: Complete 2D Visual Overhaul - Isometric to Flat Top-Down

- NEW: Flat2DTerrainSystem.js (375 lines)
- NEW: map2d_data.js procedural map (221 lines)
- MODIFIED: GameScene async create, 2D terrain integration
- MODIFIED: Player.js flat 2D positioning
- MODIFIED: game.js disabled pixelArt for smooth rendering
- FIXED: 15+ bugs (updateCulling, isometric conversions, grid lines)
- ADDED: Phase 28 to TASKS.md
- DOCS: DNEVNIK.md session summary

Result: Working flat 2D game with Stardew Valley style!
Time: 5.5 hours
This commit is contained in:
2025-12-14 17:12:40 +01:00
parent c3dd39e1a6
commit 80bddf5d61
37 changed files with 8164 additions and 1800 deletions

View File

@@ -0,0 +1,86 @@
/**
* GLOBAL INVENTORY HELPER
* Provides simple object-based inventory access for compatibility
* with simple crafting system format
*
* Automatically syncs with InventorySystem
*/
window.inventory = new Proxy({}, {
/**
* GET - Read inventory count
* Usage: inventory.wood → returns wood count
*/
get(target, prop) {
if (typeof prop === 'symbol' || prop === 'toJSON' || prop === 'toString') {
return target[prop];
}
const gameScene = window.gameState?.gameScene;
if (!gameScene || !gameScene.inventorySystem) {
console.warn('⚠️ InventorySystem not ready yet');
return 0;
}
return gameScene.inventorySystem.getItemCount(prop);
},
/**
* SET - Modify inventory count
* Usage: inventory.wood = 10 → sets wood to 10
* Usage: inventory.wood += 5 → adds 5 wood
* Usage: inventory.wood -= 2 → removes 2 wood
*/
set(target, prop, value) {
if (typeof prop === 'symbol') {
target[prop] = value;
return true;
}
const gameScene = window.gameState?.gameScene;
if (!gameScene || !gameScene.inventorySystem) {
console.warn('⚠️ InventorySystem not ready yet');
return false;
}
// Get current count
const currentCount = gameScene.inventorySystem.getItemCount(prop);
const difference = value - currentCount;
if (difference > 0) {
// Add items
gameScene.inventorySystem.addItem(prop, difference);
} else if (difference < 0) {
// Remove items
gameScene.inventorySystem.removeItem(prop, Math.abs(difference));
}
// ✨ AUTO UI UPDATE
gameScene.inventorySystem.updateUI();
return true;
}
});
/**
* Global helper function for simple crafting system
*/
window.addItemToInventory = function (itemKey, quantity) {
const gameScene = window.gameState?.gameScene;
if (!gameScene || !gameScene.inventorySystem) {
console.warn('⚠️ InventorySystem not ready yet');
return false;
}
const result = gameScene.inventorySystem.addItem(itemKey, quantity);
// ✨ AUTO UI UPDATE
gameScene.inventorySystem.updateUI();
return result;
};
console.log('✅ Global inventory helper initialized');
console.log('💡 Usage: inventory.wood, inventory.stone, etc.');
console.log('💡 Usage: inventory.wood = 10, inventory.wood += 5, etc.');
console.log('✨ UI auto-updates on inventory change!');