This commit is contained in:
2025-12-07 21:31:44 +01:00
parent 4a0ca267ea
commit 974141c08c
52 changed files with 2485 additions and 397 deletions

View File

@@ -268,18 +268,43 @@ class TextureGenerator {
x.fillStyle = 'gray'; x.fillRect(8, 12, 16, 4);
c.refresh();
}
if (!scene.textures.exists('item_hoe')) {
const c = scene.textures.createCanvas('item_hoe', 32, 32);
const x = c.getContext();
x.fillStyle = 'brown'; x.fillRect(14, 10, 4, 18); // Ročaj
x.fillStyle = 'gray';
x.fillRect(10, 8, 12, 4); // Rezilo motike
c.refresh();
}
if (!scene.textures.exists('item_sword')) {
const c = scene.textures.createCanvas('item_sword', 32, 32);
const x = c.getContext();
x.fillStyle = 'brown'; x.fillRect(14, 10, 4, 14); // Ročaj
x.fillStyle = 'gray';
x.fillRect(12, 8, 8, 12); // Rezilo meča
x.fillStyle = 'gold'; x.fillRect(14, 21, 4, 2); // Guard
c.refresh();
}
}
static createItemSprites(scene) {
// Placeholder item generation
const items = ['wood', 'stone', 'seed', 'item_bone']; // Ensure item_bone is here
items.forEach(it => {
const items = [
{ name: 'wood', color: '#8B4513' }, // Rjava
{ name: 'stone', color: '#808080' }, // Siva
{ name: 'seeds', color: '#90EE90' }, // Svetlo zelena
{ name: 'wheat', color: '#FFD700' }, // Zlata
{ name: 'item_bone', color: '#F5F5DC' } // Beige
];
items.forEach(item => {
const it = typeof item === 'string' ? item : item.name;
const color = typeof item === 'string' ? 'gold' : item.color;
const k = (it.startsWith('item_')) ? it : 'item_' + it;
if (!scene.textures.exists(k)) {
const c = scene.textures.createCanvas(k, 32, 32);
const x = c.getContext();
x.clearRect(0, 0, 32, 32);
x.fillStyle = 'gold';
x.fillStyle = color;
x.beginPath(); x.arc(16, 16, 10, 0, Math.PI * 2); x.fill();
c.refresh();
}