farma updejt

This commit is contained in:
2025-12-08 01:39:39 +01:00
parent 9c61c3b56d
commit e49f567831
12 changed files with 596 additions and 99 deletions

View File

@@ -384,36 +384,138 @@ class TextureGenerator {
}
static createToolSprites(scene) {
// Placeholder tool generation
// --- REALISTIC TOOLS (Procedural Generation) ---
// 1. AXE (Sekira)
if (!scene.textures.exists('item_axe')) {
const c = scene.textures.createCanvas('item_axe', 32, 32);
const x = c.getContext();
x.fillStyle = 'brown'; x.fillRect(14, 10, 4, 18);
x.fillStyle = 'gray'; x.fillRect(12, 10, 8, 6);
const ctx = c.getContext();
ctx.clearRect(0, 0, 32, 32);
// Handle (Wood)
ctx.fillStyle = '#8B4513';
ctx.fillRect(14, 12, 4, 18);
// Head (Metal)
ctx.fillStyle = '#708090'; // SlateGray
ctx.beginPath();
ctx.moveTo(16, 12);
ctx.lineTo(24, 6); // Top edge
ctx.lineTo(24, 18); // Bottom edge
ctx.lineTo(16, 14); // Back to handle
ctx.fill();
// Edge (Sharp)
ctx.fillStyle = '#C0C0C0'; // Silver
ctx.fillRect(23, 6, 2, 12);
c.refresh();
}
// 2. PICKAXE (Kramp)
if (!scene.textures.exists('item_pickaxe')) {
const c = scene.textures.createCanvas('item_pickaxe', 32, 32);
const x = c.getContext();
x.fillStyle = 'brown'; x.fillRect(14, 10, 4, 18);
x.fillStyle = 'gray'; x.fillRect(8, 12, 16, 4);
const ctx = c.getContext();
ctx.clearRect(0, 0, 32, 32);
// Handle
ctx.fillStyle = '#8B4513';
ctx.fillRect(14, 10, 4, 20);
// Head (Curved Metal)
ctx.fillStyle = '#696969'; // DimGray
ctx.beginPath();
ctx.moveTo(6, 14); // Left tip
ctx.quadraticCurveTo(16, 4, 26, 14); // Curve over handle
ctx.lineTo(26, 16);
ctx.quadraticCurveTo(16, 8, 6, 16);
ctx.fill();
// Tips
ctx.fillStyle = '#DCDCDC';
ctx.fillRect(5, 14, 2, 2);
ctx.fillRect(25, 14, 2, 2);
c.refresh();
}
// 3. HOE (Motika)
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
const ctx = c.getContext();
ctx.clearRect(0, 0, 32, 32);
// Handle
ctx.fillStyle = '#8B4513';
ctx.fillRect(14, 6, 4, 24);
// Head
ctx.fillStyle = '#778899'; // LightSlateGray
ctx.fillRect(12, 6, 10, 4); // Top bar
ctx.fillRect(12, 6, 4, 8); // Blade down
// Blade Edge
ctx.fillStyle = '#C0C0C0';
ctx.fillRect(12, 12, 4, 2);
c.refresh();
}
// 4. SWORD (Meč)
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
const ctx = c.getContext();
ctx.clearRect(0, 0, 32, 32);
// Handle
ctx.fillStyle = '#8B4513';
ctx.fillRect(15, 24, 2, 6);
// Pommel
ctx.fillStyle = '#FFD700'; // Gold
ctx.fillRect(14, 29, 4, 2);
// Guard
ctx.fillStyle = '#FFD700';
ctx.fillRect(11, 22, 10, 2);
// Blade
ctx.fillStyle = '#C0C0C0'; // Silver
ctx.fillRect(14, 4, 4, 18);
// Blood Groove / Shine
ctx.fillStyle = '#F0F8FF'; // AliceBlue
ctx.fillRect(15, 4, 2, 18);
c.refresh();
}
// 5. WATERING CAN (Zalivalka)
if (!scene.textures.exists('item_watering_can')) {
const c = scene.textures.createCanvas('item_watering_can', 32, 32);
const ctx = c.getContext();
ctx.clearRect(0, 0, 32, 32);
// Body
ctx.fillStyle = '#A9A9A9'; // DarkGray
ctx.fillRect(8, 12, 16, 14);
// Handle
ctx.strokeStyle = '#696969';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(8, 14);
ctx.quadraticCurveTo(4, 10, 8, 6);
ctx.lineTo(20, 6);
ctx.stroke();
// Spout
ctx.fillStyle = '#A9A9A9';
ctx.beginPath();
ctx.moveTo(24, 16);
ctx.lineTo(30, 10);
ctx.lineTo(28, 20);
ctx.fill();
c.refresh();
}
}
@@ -425,6 +527,8 @@ class TextureGenerator {
{ name: 'stone', color: '#808080' }, // Siva
{ name: 'seeds', color: '#90EE90' }, // Svetlo zelena
{ name: 'wheat', color: '#FFD700' }, // Zlata
{ name: 'corn', color: '#FFD700' }, // Zlata (Corn)
{ name: 'seeds_corn', color: '#B22222' },// FireBrick seeds
{ name: 'item_bone', color: '#F5F5DC' }, // Beige
{ name: 'item_scrap', color: '#B87333' }, // Copper/Bronze (kovinski kos)
{ name: 'item_chip', color: '#00CED1' } // DarkTurquoise (elektronski chip)
@@ -464,6 +568,41 @@ class TextureGenerator {
canvas.refresh();
}
static createCornSprites(scene) {
for (let i = 1; i <= 4; i++) {
const key = `corn_stage_${i}`;
if (scene.textures.exists(key)) continue;
// Corn is taller
const canvas = scene.textures.createCanvas(key, 32, 64);
const ctx = canvas.getContext();
ctx.clearRect(0, 0, 32, 64);
const startY = 64;
// Stalk
ctx.fillStyle = '#556B2F'; // DarkOliveGreen
const height = 10 + (i * 10);
ctx.fillRect(14, startY - height, 4, height);
// Leaves
ctx.fillStyle = '#32CD32'; // LimeGreen
if (i >= 2) {
ctx.beginPath(); ctx.ellipse(10, startY - height + 10, 8, 3, 0.5, 0, Math.PI * 2); ctx.fill();
ctx.beginPath(); ctx.ellipse(22, startY - height + 15, 8, 3, -0.5, 0, Math.PI * 2); ctx.fill();
}
// Cobs (Only stage 4)
if (i === 4) {
ctx.fillStyle = '#FFD700'; // Gold
ctx.fillRect(12, startY - height + 20, 4, 8);
ctx.fillRect(18, startY - height + 25, 4, 8);
}
canvas.refresh();
}
}
// Helper to generate ALL textures at once
generateAll() {
TextureGenerator.createPlayerSprite(this.scene);
@@ -473,15 +612,17 @@ class TextureGenerator {
TextureGenerator.createFlowerSprite(this.scene);
TextureGenerator.createBushSprite(this.scene);
TextureGenerator.createSaplingSprite(this.scene, 'tree_sapling'); // Dodano
TextureGenerator.createTreeSprite(this.scene); // Volumetric
TextureGenerator.createRockSprite(this.scene); // Volumetric
TextureGenerator.createSaplingSprite(this.scene, 'tree_sapling');
TextureGenerator.createTreeSprite(this.scene);
TextureGenerator.createRockSprite(this.scene);
TextureGenerator.createCloudSprite(this.scene);
// Crops
TextureGenerator.createCropSprite(this.scene, 'crop_stage_1', 1);
TextureGenerator.createCropSprite(this.scene, 'crop_stage_2', 2);
TextureGenerator.createCropSprite(this.scene, 'crop_stage_3', 3);
TextureGenerator.createCropSprite(this.scene, 'crop_stage_4', 4);
TextureGenerator.createCropSprite(this.scene, 'crop_stage_5', 5);
TextureGenerator.createCornSprites(this.scene); // Added Corn
TextureGenerator.createGravestoneSprite(this.scene);
TextureGenerator.createToolSprites(this.scene);