test
This commit is contained in:
@@ -66,6 +66,45 @@ class GameScene extends Phaser.Scene {
|
||||
this.buildSystem = new BuildSystem(this);
|
||||
console.log('🏗️ Build system initialized!');
|
||||
|
||||
// ========================================================
|
||||
// 🏗️ TESTNI PRIMERI - Postavitev Ograj (ONEMOGOČENO)
|
||||
// ========================================================
|
||||
// Odstrani // pred vrsticami, če želiš videti testne ograje!
|
||||
// ALI pritisni B v igri za Build Mode in postavljaj ročno!
|
||||
|
||||
// PRIMER 1: Ena sama ograja
|
||||
// this.buildSystem.placeSingleFence(50, 50, 'fence_post', false);
|
||||
|
||||
// PRIMER 2: Vodoravna linija ograj (10 ograj)
|
||||
// for (let i = 0; i < 10; i++) {
|
||||
// this.buildSystem.placeSingleFence(45 + i, 52, 'fence_horizontal', false);
|
||||
// }
|
||||
|
||||
// PRIMER 3: Navpična linija ograj (10 ograj)
|
||||
// for (let i = 0; i < 10; i++) {
|
||||
// this.buildSystem.placeSingleFence(43, 48 + i, 'fence_vertical', false);
|
||||
// }
|
||||
|
||||
// PRIMER 4: Majhen pravokotnik (8x6)
|
||||
// this.buildSystem.placeFenceRectangle(60, 45, 8, 6, 'fence_post', false);
|
||||
|
||||
// PRIMER 5: Diagonalna linija (Bresenham)
|
||||
// this.buildSystem.placeFenceLine(30, 30, 40, 40, 'fence_corner', false);
|
||||
|
||||
// PRIMER 6: Večji pravokotnik (20x15)
|
||||
// this.buildSystem.placeFenceRectangle(20, 60, 20, 15, 'fence_horizontal', false);
|
||||
|
||||
// PRIMER 7: Različni tipi ograj v vrsti
|
||||
// this.buildSystem.placeSingleFence(70, 50, 'fence', false);
|
||||
// this.buildSystem.placeSingleFence(71, 50, 'fence_post', false);
|
||||
// this.buildSystem.placeSingleFence(72, 50, 'fence_horizontal', false);
|
||||
// this.buildSystem.placeSingleFence(73, 50, 'fence_vertical', false);
|
||||
// this.buildSystem.placeSingleFence(74, 50, 'fence_corner', false);
|
||||
|
||||
// console.log('✅ Testne ograje postavljene! Preveri mapo.');
|
||||
// ========================================================
|
||||
|
||||
|
||||
// Terrain offset
|
||||
this.terrainOffsetX = width / 2;
|
||||
this.terrainOffsetY = 100;
|
||||
@@ -79,6 +118,136 @@ class GameScene extends Phaser.Scene {
|
||||
// INITIALIZE FARM AREA (Starter Zone @ 20,20)
|
||||
this.initializeFarmWorld();
|
||||
|
||||
// 🍎 SADOVNJAK - Sadna Drevesa (ONEMOGOČENO)
|
||||
// ========================================================
|
||||
// Odstrani // če želiš sadovnjak
|
||||
/*
|
||||
console.log('🍎 Ustvarjam sadovnjak...');
|
||||
|
||||
const orchardX = 35; // Lokacija sadovnjaka
|
||||
const orchardY = 60;
|
||||
const orchardSize = 10; // 10x10 območje
|
||||
|
||||
// 1. Očisti območje (odstrani obstoječe drevese)
|
||||
for (let x = orchardX; x < orchardX + orchardSize; x++) {
|
||||
for (let y = orchardY; y < orchardY + orchardSize; y++) {
|
||||
if (x >= 0 && x < 100 && y >= 0 && y < 100) {
|
||||
const key = `${x},${y}`;
|
||||
if (this.terrainSystem.decorationsMap.has(key)) {
|
||||
this.terrainSystem.removeDecoration(x, y);
|
||||
}
|
||||
|
||||
// Spremeni teren v travo
|
||||
if (this.terrainSystem.tiles[y] && this.terrainSystem.tiles[y][x]) {
|
||||
this.terrainSystem.tiles[y][x].type = 'grass';
|
||||
if (this.terrainSystem.tiles[y][x].sprite) {
|
||||
this.terrainSystem.tiles[y][x].sprite.setTexture('grass');
|
||||
this.terrainSystem.tiles[y][x].sprite.clearTint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Dodaj SADIKE (tree_sapling) - bodo rasle v sadna drevesa!
|
||||
const fruitTreeTypes = ['tree_apple', 'tree_orange', 'tree_cherry'];
|
||||
let treeCount = 0;
|
||||
const saplingPositions = []; // Shrani pozicije za ograje
|
||||
|
||||
for (let x = orchardX + 1; x < orchardX + orchardSize - 1; x += 2) {
|
||||
for (let y = orchardY + 1; y < orchardY + orchardSize - 1; y += 2) {
|
||||
if (x >= 0 && x < 100 && y >= 0 && y < 100) {
|
||||
// Dodaj SADIKO (bo rasla v sadno drevo)
|
||||
this.terrainSystem.addDecoration(x, y, 'tree_sapling');
|
||||
saplingPositions.push({ x, y, type: fruitTreeTypes[treeCount % fruitTreeTypes.length] });
|
||||
treeCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Dodaj LESENO OGRAJO okoli vsakega drevesa (3x3 kvadrat)
|
||||
saplingPositions.forEach(pos => {
|
||||
// Ograja okoli drevesa (3x3)
|
||||
const fencePositions = [
|
||||
// Zgornja vrstica
|
||||
{ x: pos.x - 1, y: pos.y - 1 },
|
||||
{ x: pos.x, y: pos.y - 1 },
|
||||
{ x: pos.x + 1, y: pos.y - 1 },
|
||||
// Spodnja vrstica
|
||||
{ x: pos.x - 1, y: pos.y + 1 },
|
||||
{ x: pos.x, y: pos.y + 1 },
|
||||
{ x: pos.x + 1, y: pos.y + 1 },
|
||||
// Leva stran
|
||||
{ x: pos.x - 1, y: pos.y },
|
||||
// Desna stran
|
||||
{ x: pos.x + 1, y: pos.y }
|
||||
];
|
||||
|
||||
fencePositions.forEach(fPos => {
|
||||
if (fPos.x >= 0 && fPos.x < 100 && fPos.y >= 0 && fPos.y < 100) {
|
||||
this.buildSystem.placeSingleFence(fPos.x, fPos.y, 'fence_horizontal', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 4. Dodaj ZUNANJO OGRAJO okoli celega sadovnjaka
|
||||
this.buildSystem.placeFenceRectangle(
|
||||
orchardX - 1,
|
||||
orchardY - 1,
|
||||
orchardSize + 2,
|
||||
orchardSize + 2,
|
||||
'fence_post',
|
||||
false
|
||||
);
|
||||
|
||||
// 5. Dodaj cvetje med ograjami
|
||||
for (let x = orchardX; x < orchardX + orchardSize; x++) {
|
||||
for (let y = orchardY; y < orchardY + orchardSize; y++) {
|
||||
if (x >= 0 && x < 100 && y >= 0 && y < 100) {
|
||||
const key = `${x},${y}`;
|
||||
if (!this.terrainSystem.decorationsMap.has(key) && Math.random() > 0.85) {
|
||||
this.terrainSystem.addDecoration(x, y, 'flowers_new');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6. RAST DREVES - Sadike bodo rasle v sadna drevesa!
|
||||
// Nastavi timer za rast (vsako drevo raste po 30 sekundah)
|
||||
saplingPositions.forEach((pos, index) => {
|
||||
this.time.delayedCall(30000 + (index * 2000), () => {
|
||||
const key = `${pos.x},${pos.y}`;
|
||||
|
||||
// Odstrani sadiko
|
||||
if (this.terrainSystem.decorationsMap.has(key)) {
|
||||
this.terrainSystem.removeDecoration(pos.x, pos.y);
|
||||
}
|
||||
|
||||
// Dodaj SADNO DREVO
|
||||
this.terrainSystem.addDecoration(pos.x, pos.y, pos.type);
|
||||
|
||||
// Animacija rasti
|
||||
if (this.terrainSystem.visibleDecorations.has(key)) {
|
||||
const sprite = this.terrainSystem.visibleDecorations.get(key);
|
||||
sprite.setScale(0.01);
|
||||
this.tweens.add({
|
||||
targets: sprite,
|
||||
scaleX: 0.04,
|
||||
scaleY: 0.04,
|
||||
duration: 2000,
|
||||
ease: 'Bounce.out'
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`🌳 Drevo zraslo: ${pos.type} na (${pos.x}, ${pos.y})`);
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`✅ Sadovnjak ustvarjen na (${orchardX}, ${orchardY}) - ${treeCount} sadik (bodo rasle v 30s)`);
|
||||
*/
|
||||
// ========================================================
|
||||
|
||||
|
||||
// CITY CONTENT: Ruins, Chests, Spawners
|
||||
console.log('🏚️ Generating City Content...');
|
||||
|
||||
@@ -248,6 +417,17 @@ class GameScene extends Phaser.Scene {
|
||||
|
||||
this.statsSystem = new StatsSystem(this);
|
||||
this.inventorySystem = new InventorySystem(this);
|
||||
|
||||
// ========================================================
|
||||
// 💎 NEOMEJENI VIRI - Les in Kamen
|
||||
// ========================================================
|
||||
console.log('💎 Dodajam neomejene vire...');
|
||||
this.inventorySystem.addItem('wood', 999999);
|
||||
this.inventorySystem.addItem('stone', 999999);
|
||||
this.inventorySystem.gold = 999999;
|
||||
console.log('✅ Neomejeni viri dodani: 999,999 lesa, kamna in zlata!');
|
||||
// ========================================================
|
||||
|
||||
this.lootSystem = new LootSystem(this);
|
||||
this.interactionSystem = new InteractionSystem(this);
|
||||
this.farmingSystem = new FarmingSystem(this);
|
||||
@@ -502,6 +682,7 @@ class GameScene extends Phaser.Scene {
|
||||
if (this.player) this.player.update(delta);
|
||||
|
||||
// Update Systems
|
||||
if (this.terrainSystem) this.terrainSystem.update(time, delta); // Water animation!
|
||||
if (this.statsSystem) this.statsSystem.update(delta);
|
||||
if (this.lootSystem) this.lootSystem.update(delta);
|
||||
if (this.interactionSystem) this.interactionSystem.update(delta);
|
||||
|
||||
Reference in New Issue
Block a user