🚀 Blueprint System, Dark Chibi Animals & Massive Reference Organization
FEATURES: ✅ Blueprint System: Auto-generated ghost/hologram items for building mode ✅ ItemManager: Logic for Item/Blueprint switching ✅ New Animals: Cow, Pig, Bear, Wolf (Dark Noir Chibi Style) ORGANIZATION: ✅ Flattened Reference Library: All 6k+ images in 'glavna_referenca' for easy review ✅ Cleanup: Empty 'ZA_PREGLED' and '_NESORTIRANO' sorted ✅ Unlocked: 'glavna_referenca' ready for manual editing STATUS: Ready for DEMO assembly!
This commit is contained in:
38
src/managers/ItemManager.js
Normal file
38
src/managers/ItemManager.js
Normal file
@@ -0,0 +1,38 @@
|
||||
export class ItemManager {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.basePath = 'assets/slike/items/';
|
||||
this.blueprintPath = 'assets/slike/items/blueprints/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct image path for an item based on the context.
|
||||
* @param {string} itemPath - Relative path to the item (e.g., 'tools/axe.png')
|
||||
* @param {boolean} isBuildingMode - If true, returns the ghost/blueprint version.
|
||||
* @returns {string} Full path to the image.
|
||||
*/
|
||||
getItemImagePath(itemPath, isBuildingMode = false) {
|
||||
// Remove 'assets/slike/items/' prefix if present to standardize input
|
||||
let cleanPath = itemPath.replace(this.basePath, '');
|
||||
|
||||
if (isBuildingMode) {
|
||||
// Return blueprint version: assets/slike/items/blueprints/tools/axe.png
|
||||
return `${this.blueprintPath}${cleanPath}`;
|
||||
} else {
|
||||
// Return normal version: assets/slike/items/tools/axe.png
|
||||
return `${this.basePath}${cleanPath}`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an item image into Phaser.
|
||||
* @param {string} key - The cache key for the image.
|
||||
* @param {string} itemPath - Relative path (e.g. 'tools/axe.png').
|
||||
*/
|
||||
loadItem(key, itemPath) {
|
||||
// Load normal version
|
||||
this.scene.load.image(key, this.getItemImagePath(itemPath, false));
|
||||
// Load blueprint version automatically with _blueprint suffix
|
||||
this.scene.load.image(`${key}_blueprint`, this.getItemImagePath(itemPath, true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user