User prompt
Kervan panelini açtıktan 1 dakik sonra kervan gitsin. Gittikten 2 dakika sonra geri gelsin.
User prompt
Kervan gelince "Kervan Geldi" yazan yer, kervan gitmesine ne kadar süre kaldığını da yazsın. Çünkü kervan geldikten 1 dakika sonra gidecek. 2 dakika sonra güncel fiyat ve güncel stok ile geri gelecek.
User prompt
Kervan içi yazı ve işlevleri olduğu gibi %25 yukarı taşı. Arkaplan yeri sabit kalsın.
User prompt
Hangar ve kervan paneli ön planda açılsın. Ana ekran unsurları görünmesin. Paneller açılınca Gizlenen kısım yalnızca panelin arkaplan resmi boyutunca olsun. Panel harici kısımlar görünmeye devam etsin.
User prompt
Bütün Paneller ön planda açılsın. Ana ekran unsurları görünmesin. Paneller açılınca Gizlenen kısım yalnızca panelin arkaplan resmi boyutunca olsun. Panel harici kısımlar görünmeye devam etsin.
User prompt
Kervan panel resmine ait özel resim dosyası oluştur.
User prompt
Kervanlar geldikten sonra 1 dakika sonra gitsinler ve 2 dakika sonra güncel stok ile geri gelsinler.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var p = 0; p < productTypes.length; p++) {' Line Number: 2911
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var p = 0; p < productTypes.length; p++) {' Line Number: 2909
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var p = 0; p < productTypes.length; p++) {' Line Number: 2909
User prompt
Haritanın başlangıç yerinin soluna Bir HANGAR isminde bir stok yeri oluştur. Oluşturulan depoya panel ekle. Kervan'dan aldığımız ürünler bu depoya stoklansın. Ayrıca yeni-eski bütün fabrika stokları da stoktaymış gibi yer alsın. Fabrikalar bu depodaki ürünleri kullanabilsin.
User prompt
Paneli en ön planda aç. Panel resmini aşağı doğru yazının en altına gelecek şekilde uzat. Ayrıca panel içerisine ortalama fiyata göre ürün fiyatlarının kâr ve zarar oranlarını da göster.
User prompt
Kervan paneli neden açılmıyor. Bütün kervan ile alakalı kodları kontrol et. Ve çözüm üret veya çöz.
User prompt
Kervan paneli açılmıyor. Kodları kontrol et ve engel olan ne varsa düzenle.
User prompt
Kervan paneli açılmıyor. Görüntülenmesini sağla.
User prompt
Kervan panel konumunu ortala.
User prompt
Kervanın resmine tıklayınca panelin açılmasını sağla. Kervan resmine panel linki yerleştir.
User prompt
Kervanın resmine tıklayınca panelin açılmasını sağla. Tıklıyorum birşey olmuyor.
User prompt
Kervan haritanın orta kısımlarına gelsin. Çok kenarda duruyor.
User prompt
Kervanın resmine tıklayınca panelin açılmasını sağla. Tıklıyorum birşey olmuyor.
User prompt
Karavanın spawn olduğu yer ile, gideceği yerin koordinatları sıfırla. Rastgele yerden gelsin ve rastgele yerde dursun.
User prompt
Please fix the bug: 'ReferenceError: caravanPanelBuyBtn is not defined' in or related to this line: 'if (caravanPanelBuyBtn && caravanPanelBuyBtn.visible) {' Line Number: 3967
User prompt
Oyuna kervan sistemi getirmek istiyorum. Bu kervana bir panel oluştur. Panelde kervan ile karşılıklı ticaret yapacağız. Kervanın stoğun da daima Minimum 5 maximum 30 olmak suretiyle hammadde bulunacak. Ayrıca ürünlerden rastgele olarak 1 ile 20 arasında 5 çeşit ürün bulunacak. Bu hammadde ve ürünleri bana normal satış fiyatının %10 fazlasına satacak. Ben ise ona stokta bulunan bütün ürünleri %10 zararına satabileceğim. Bu kervan ile ticareti onaylayıp paneli kapatınca 1 ila 3 dakika aralıklarla tekrar gelecek. Ama hiçbir ticaret yapmaz isek 1 dakika sonra oradan ayrılacak. Kervan haritanın sol üst kısmından gelerek, oyunun sağ alt köşesinde bulunan DEPO yerine geldiğinde aktif hale gelecek. Bahsettiğim kervan için bir kod yaz. Bu isteğimi tamamladın mı? Ben böyle istemiştim.
User prompt
Kervan paneli açılınca arka planda olan anasayfa gizlensin.
User prompt
Kervan paneli içeriğini panel arka planına göre yeniden yerleştir. Çok dağınık görünüyor yazılar ve butonlar.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // 10 minutes in seconds (will be converted to ticks) // --- BUSINESS PANEL CLASS --- // İşletmeler paneli ve sistemi var BusinessPanel = Container.expand(function () { var self = Container.call(this); // Panel arka planı var panelBg = LK.getAsset('businessPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 900, scaleX: 1.1, scaleY: 1.1 }); panelBg.alpha = 0.97; self.addChild(panelBg); // Panel başlığı var title = new Text2('İşletmeler', { size: 38, fill: "#000", fontWeight: "bold" }); title.anchor.set(0.5, 0.5); title.x = panelBg.x; title.y = panelBg.y - panelBg.height / 2 + 60; self.addChild(title); // İşletme tanımları var businessDefs = [{ name: "Çiftlik", price: 500, baseBonus: 0.03, levelBonus: 0.02, desc: "Satılan ürün başı %3 kar, seviye başı %2 artış", icon: null // İleride ikon eklenebilir }, { name: "Tarla", price: 1000, baseBonus: 0.05, levelBonus: 0.02, desc: "Satılan ürün başı %5 kar, seviye başı %2 artış", icon: null }, { name: "Demirci", price: 1500, baseBonus: 0.10, levelBonus: 0.02, desc: "Satılan ürün başı %10 kar, seviye başı %2 artış", icon: null }, { name: "Köşk", price: 2000, baseBonus: 0.15, levelBonus: 0.02, desc: "Satılan ürün başı %15 kar, seviye başı %2 artış", icon: null }, { name: "Kale", price: 5000, baseBonus: 0.20, levelBonus: 0.02, desc: "Satılan ürün başı %20 kar, seviye başı %2 artış", icon: null }]; // İşletme state: [{level: 0, owned: false}] self.businesses = []; for (var i = 0; i < businessDefs.length; i++) { self.businesses.push({ level: 0, owned: false }); } // Satır yüksekliği ve panel içi layout // Panel boyutuna göre orantılı satır yüksekliği ve yazı boyutları var contentMargin = Math.round(panelBg.height * 0.07); // üstten boşluk var rowHeight = Math.round(panelBg.height * 0.18); // Satır yüksekliği biraz artırıldı var startY = panelBg.y - panelBg.height / 2 + contentMargin + Math.round(rowHeight / 2); // Panel genişliğine göre kolon oranları var colName = Math.round(panelBg.width * 0.13); var colDesc = Math.round(panelBg.width * 0.32); var colLevel = Math.round(panelBg.width * 0.23); var colBtn = Math.round(panelBg.width * 0.22); // Tüm yazı fontları 36 var nameFontSize = 36; var descFontSize = 36; var levelFontSize = 36; var btnFontSize = 36; self.rows = []; for (var i = 0; i < businessDefs.length; i++) { var y = startY + i * rowHeight; // İsim var nameTxt = new Text2(businessDefs[i].name, { size: nameFontSize, fill: "#000", fontWeight: "bold" }); nameTxt.anchor.set(0, 0.5); nameTxt.x = panelBg.x - panelBg.width / 2 + colName; nameTxt.y = y; self.addChild(nameTxt); // Açıklama (işletme isminin altına hizala) var descTxt = new Text2(businessDefs[i].desc, { size: descFontSize, fill: "#333" }); descTxt.anchor.set(0, 0); descTxt.x = nameTxt.x; descTxt.y = nameTxt.y + nameTxt.height / 2 + 4; // ismin altına 4px boşlukla hizala self.addChild(descTxt); // Seviye var levelTxt = new Text2("Seviye: 0", { size: levelFontSize, fill: "#000" }); levelTxt.anchor.set(0, 0.5); levelTxt.x = panelBg.x - panelBg.width / 2 + colName + colDesc + colLevel; levelTxt.y = y; self.addChild(levelTxt); // Satın al/yükselt butonu ortada olacak şekilde hizala var btn = new Text2("Satın Al (₺" + businessDefs[i].price + ")", { size: btnFontSize, fill: 0x2E7D32, fontWeight: "bold" }); btn.anchor.set(0.5, 0.5); // Çiftlik ismi ile seviye yazısının ortasına hizala btn.x = (nameTxt.x + levelTxt.x) / 2 + nameTxt.width / 2; // ismin ortası ile seviye yazısının başı arasında ortala btn.y = y; self.addChild(btn); // Buton event (function (idx) { btn.down = function () { var biz = self.businesses[idx]; if (!biz.owned) { // Satın alma if (money >= businessDefs[idx].price) { money -= businessDefs[idx].price; biz.owned = true; biz.level = 1; updateMoneyText(); self.updateRows(); } } else { // Seviye yükseltme var upgradeCost = businessDefs[idx].price * (biz.level + 1); if (money >= upgradeCost) { money -= upgradeCost; biz.level++; updateMoneyText(); self.updateRows(); } } }; })(i); self.rows.push({ nameTxt: nameTxt, descTxt: descTxt, levelTxt: levelTxt, btn: btn }); } // Paneli güncelle self.updateRows = function () { for (var i = 0; i < businessDefs.length; i++) { var biz = self.businesses[i]; var row = self.rows[i]; if (!biz.owned) { row.levelTxt.setText("Seviye: 0"); row.btn.setText("Satın Al (₺" + businessDefs[i].price + ")"); row.btn.fill = "#2e7d32"; } else { row.levelTxt.setText("Seviye: " + biz.level); var upgradeCost = businessDefs[i].price * (biz.level + 1); row.btn.setText("Yükselt (₺" + upgradeCost + ")"); row.btn.fill = "#1565c0"; } // Buton pasif/gri yap var enoughMoney = !biz.owned ? money >= businessDefs[i].price : money >= businessDefs[i].price * (biz.level + 1); row.btn.alpha = enoughMoney ? 1 : 0.4; } }; // Kapat ikonu ekle var closeIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); closeIcon.anchor.set(0.5, 0.5); closeIcon.x = panelBg.x + panelBg.width / 2 - 30; closeIcon.y = panelBg.y - panelBg.height / 2 + 30; closeIcon.visible = false; self.addChild(closeIcon); closeIcon.down = function () { self.toggle(); }; // Paneli başta gizle self.visible = false; // Paneli aç/kapat fonksiyonu self.toggle = function () { self.visible = !self.visible; panelBg.visible = self.visible; title.visible = self.visible; closeIcon.visible = self.visible; for (var i = 0; i < self.rows.length; i++) { self.rows[i].nameTxt.visible = self.visible; self.rows[i].descTxt.visible = self.visible; self.rows[i].levelTxt.visible = self.visible; self.rows[i].btn.visible = self.visible; } if (self.visible) self.updateRows(); }; // Paneli başta gizle panelBg.visible = false; title.visible = false; for (var i = 0; i < self.rows.length; i++) { self.rows[i].nameTxt.visible = false; self.rows[i].descTxt.visible = false; self.rows[i].levelTxt.visible = false; self.rows[i].btn.visible = false; } return self; }); // --- CARAVAN CLASS --- // Kervan: Şehirler arası/uzak fabrikalar arası toplu ürün/hammadde taşıyan sistem var Caravan = Container.expand(function () { var self = Container.call(this); // Kervan görseli (artık özel caravan resmi kullanılıyor) var caravanSprite = self.attachAsset('caravan', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; self.state = 'idle'; // 'idle', 'toSource', 'toTarget', 'returning' self.source = null; // Kaynak fabrika/şehir self.target = null; // Hedef fabrika/şehir self.cargo = null; // {type: 'ore'|'wood'|'food'|'product', count: int} self.route = []; // Güzergah noktaları (ileride kullanılabilir) self.lastX = 0; self.lastY = 0; // Kervanı bir kaynaktan hedefe gönder self.send = function (source, target, cargoType, count) { self.state = 'toSource'; self.source = source; self.target = target; self.cargo = { type: cargoType, count: count || 1 }; self.x = source.x; self.y = source.y; self.lastX = self.x; self.lastY = self.y; }; // Hedefe doğru hareket et self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = self.speed; if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; // Her tickte güncelle self.update = function () { if (self.state === 'toSource' && self.source) { if (self.moveTowards(self.source.x, self.source.y)) { // Kaynağa ulaştı, yükü al if (self.cargo && self.source[self.cargo.type + 'Buffer'] >= self.cargo.count) { self.source[self.cargo.type + 'Buffer'] -= self.cargo.count; self.state = 'toTarget'; } else { // Yeterli yük yoksa idle'a dön self.state = 'idle'; } } } else if (self.state === 'toTarget' && self.target) { if (self.moveTowards(self.target.x, self.target.y)) { // Hedefe ulaştı, yükü bırak if (self.cargo) { if (typeof self.target[self.cargo.type + 'Buffer'] === "number") { self.target[self.cargo.type + 'Buffer'] += self.cargo.count; } self.cargo = null; } self.state = 'returning'; } } else if (self.state === 'returning' && self.source) { if (self.moveTowards(self.source.x, self.source.y)) { self.state = 'idle'; } } self.lastX = self.x; self.lastY = self.y; }; return self; }); // Add level to Carrier (worker) var Carrier = Container.expand(function () { var self = Container.call(this); var carrierSprite = self.attachAsset('carrier', { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // Carrier level self.speed = 7; self.state = 'idle'; // 'idle', 'toFactory', 'toShop' self.target = null; self.carrying = null; //{a} // {productType: int, count: int} self.factoryTarget = null; self.shopTarget = null; self.goToFactory = function (factory) { self.state = 'toFactory'; self.target = { x: factory.x, y: factory.y }; self.factoryTarget = factory; }; self.goToShop = function (shop) { self.state = 'toShop'; self.target = { x: shop.x, y: shop.y }; self.shopTarget = shop; }; self.setIdle = function () { self.state = 'idle'; self.target = null; self.factoryTarget = null; self.shopTarget = null; self.carrying = null; }; self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = (self.speed + (self.level - 1) * 1) * getMoveMultiplier(self.level); if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; self.update = function () { if (self.state === 'toFactory' && self.factoryTarget) { if (self.moveTowards(self.factoryTarget.x, self.factoryTarget.y)) { // Arrived at factory if (!self.carrying) { // Find a product type with available product var found = false; for (var p = 0; p < 10; p++) { if (self.factoryTarget.productBuffer[p] > 0) { self.factoryTarget.productBuffer[p]--; self.carrying = { productType: p, count: 1 }; found = true; break; } } if (found && shopList.length > 0) { self.goToShop(shopList[0]); } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'toShop' && self.shopTarget) { if (self.moveTowards(self.shopTarget.x, self.shopTarget.y)) { // Arrived at shop if (self.carrying) { // Deliver product to shop if (self.shopTarget && _typeof(self.shopTarget.productBuffer) === "object") { self.shopTarget.productBuffer[self.carrying.productType] += self.carrying.count; } self.carrying = null; } // Find next product to carry var found = false; for (var f = 0; f < factoryList.length; f++) { // Tüm fabrikalardan taşıyıcı ürün taşıyabilsin (başlangıç fabrikası dahil) var isOwned = true; if (typeof businessPanel !== "undefined" && businessPanel.businesses && businessPanel.businesses[f]) { // Sadece businessPanel'de tanımlı fabrikalar için owned kontrolü yap, ilk fabrika (başlangıç) için her zaman true if (f > 0) { isOwned = businessPanel.businesses[f].owned; } } // --- DEĞİŞİKLİK: Satın alınan yeni fabrikalardan da ürün taşıyıcı alabilsin --- // isOwned true ise (yani fabrika açıldıysa veya ilk fabrika ise) taşıyıcı ürün alabilir if (isOwned) { for (var p = 0; p < 10; p++) { if (factoryList[f].productBuffer[p] > 0) { self.goToFactory(factoryList[f]); found = true; break; } } } if (found) break; } if (!found) { self.setIdle(); } } } else if (self.state === 'idle') { // Look for product to carry var found = false; for (var f = 0; f < factoryList.length; f++) { // Tüm fabrikalardan taşıyıcı ürün taşıyabilsin (başlangıç fabrikası dahil) var isOwned = true; if (typeof businessPanel !== "undefined" && businessPanel.businesses && businessPanel.businesses[f]) { // Sadece businessPanel'de tanımlı fabrikalar için owned kontrolü yap, ilk fabrika (başlangıç) için her zaman true if (f > 0) { isOwned = businessPanel.businesses[f].owned; } } // --- DEĞİŞİKLİK: Satın alınan yeni fabrikalardan da ürün taşıyıcı alabilsin (idle durumunda) --- if (isOwned) { for (var p = 0; p < 10; p++) { if (factoryList[f].productBuffer[p] > 0) { self.goToFactory(factoryList[f]); found = true; break; } } } if (found) break; } } }; return self; }); // Add level to City var City = Container.expand(function () { var self = Container.call(this); // Add city color image var citySprite = self.attachAsset('city', { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // City level self.x = 150 + 2 * 100; // Move city 2 columns (200px) right self.y = 150 + 2 * 100; // Move city 2 rows (200px) down self.customerSpawnCooldown = 0; self.customerSpawnInterval = 180; // 3 seconds at 60fps self.update = function () { self.customerSpawnCooldown--; if (self.customerSpawnCooldown <= 0) { // Only spawn customer if shop has at least 1 product var canSpawn = false; if (shopList.length > 0) { // Mağazada herhangi bir ürün çeşidi var mı? for (var p = 0; p < 10; p++) { if (shopList[0].productBuffer[p] > 0) { canSpawn = true; break; } } } self.customerSpawnCooldown = Math.max(30, self.customerSpawnInterval - (self.level - 1) * 30) + Math.floor(Math.random() * 120); if (canSpawn) { spawnCustomer(); } } }; return self; }); // Customer: Walks from city to shop, buys product if available, then leaves var Customer = Container.expand(function () { var self = Container.call(this); // Pick a random customer image for this customer var customerImages = ['customer1', 'customer2', 'customer3', 'customer4', 'customer5']; var customerImgId = customerImages[Math.floor(Math.random() * customerImages.length)]; var customerSprite = self.attachAsset(customerImgId, { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5 + Math.random() * 2; self.state = 'toShop'; // 'toShop', 'leaving' self.targetShop = null; self.hasBought = false; // Each customer wants a random product type self.wantProductType = Math.floor(Math.random() * 10); self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = self.speed * getMoveMultiplier(1); // Customers have no level, always use 1 if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; self.update = function () { if (self.state === 'toShop' && self.targetShop) { if (self.moveTowards(self.targetShop.x, self.targetShop.y)) { // Arrived at shop if (!self.hasBought) { if (self.targetShop.productBuffer[self.wantProductType] > 0) { // İstediği ürün varsa onu al self.targetShop.productBuffer[self.wantProductType]--; var basePrice = productTypes[self.wantProductType].price; var bonus = 0; if (typeof businessPanel !== "undefined" && businessPanel.businesses) { for (var b = 0; b < businessPanel.businesses.length; b++) { var biz = businessPanel.businesses[b]; if (biz.owned && biz.level > 0) { var def = businessPanel.rows[b] && businessPanel.rows[b].descTxt ? null : null; // just to avoid unused warning var def2 = businessPanel.businesses[b]; var defObj = businessPanel.rows && businessPanel.rows[b] ? null : null; var defn = businessPanel.businesses[b]; var defB = businessPanel.businesses[b]; var defD = businessPanel.businesses[b]; var defE = businessPanel.businesses[b]; var defF = businessPanel.businesses[b]; var defG = businessPanel.businesses[b]; var defH = businessPanel.businesses[b]; var defI = businessPanel.businesses[b]; // Use businessDefs from class definition var bdef = businessPanel.rows && businessPanel.rows.length === businessPanel.businesses.length ? null : null; // Use static businessDefs var defs = [{ baseBonus: 0.03, levelBonus: 0.02 }, { baseBonus: 0.05, levelBonus: 0.02 }, { baseBonus: 0.10, levelBonus: 0.02 }, { baseBonus: 0.15, levelBonus: 0.02 }, { baseBonus: 0.20, levelBonus: 0.02 }]; var def = defs[b]; bonus += def.baseBonus + def.levelBonus * (biz.level - 1); } } } money += Math.round(basePrice * (1 + bonus)); updateMoneyText(); self.hasBought = true; self.state = 'leaving'; self.leaveTarget = { x: self.x, y: -100 }; // leave upwards } else { // İstediği ürün yoksa, başka bir ürün var mı bak var foundOther = false; for (var p = 0; p < 10; p++) { if (self.targetShop.productBuffer[p] > 0) { self.targetShop.productBuffer[p]--; var basePrice = productTypes[p].price; var bonus = 0; if (typeof businessPanel !== "undefined" && businessPanel.businesses) { for (var b = 0; b < businessPanel.businesses.length; b++) { var biz = businessPanel.businesses[b]; if (biz.owned && biz.level > 0) { var defs = [{ baseBonus: 0.03, levelBonus: 0.02 }, { baseBonus: 0.05, levelBonus: 0.02 }, { baseBonus: 0.10, levelBonus: 0.02 }, { baseBonus: 0.15, levelBonus: 0.02 }, { baseBonus: 0.20, levelBonus: 0.02 }]; var def = defs[b]; bonus += def.baseBonus + def.levelBonus * (biz.level - 1); } } } money += Math.round(basePrice * (1 + bonus)); updateMoneyText(); self.hasBought = true; self.state = 'leaving'; self.leaveTarget = { x: self.x, y: -100 }; foundOther = true; break; } } // Eğer hiç ürün yoksa beklemeye devam et } } } } else if (self.state === 'leaving') { if (self.moveTowards(self.leaveTarget.x, self.leaveTarget.y)) { // Remove from game for (var i = 0; i < customerList.length; i++) { if (customerList[i] === self) { customerList.splice(i, 1); break; } } self.destroy(); } } }; return self; }); // --- ENEMY CLASS --- var Enemy = Container.expand(function () { var self = Container.call(this); self.enemyType = 1; self.attack = 10; self.defense = 10; self.maxHP = 50; self.hp = 50; self.reward = 100; self.sprite = null; self.lastWasIntersecting = false; self.x = 0; self.y = 0; self.setType = function (type, powerScale) { self.enemyType = type; var assetId = 'enemy' + type; if (self.sprite) self.sprite.destroy(); self.sprite = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); // --- Add health bar above enemy sprite --- if (self.hpBar) { self.hpBar.destroy(); self.hpBar = null; } self.hpBarBg = new Container(); self.hpBar = new Container(); // Bar background (gray) var barBg = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: self.sprite.width * 0.9, height: 18, color: 0x444444, shape: 'box' }); self.hpBarBg.addChild(barBg); // Bar foreground (green, will be scaled) self.hpBar.bar = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: self.sprite.width * 0.88, height: 12, color: 0x4caf50, shape: 'box' }); self.hpBar.addChild(self.hpBar.bar); // Position bar above the sprite self.hpBarBg.x = 0; self.hpBarBg.y = -self.sprite.height / 2 - 18; self.hpBar.x = 0; self.hpBar.y = -self.sprite.height / 2 - 18; self.addChild(self.hpBarBg); self.addChild(self.hpBar); // Randomize stats based on powerScale (0.5 to 2.0) // Canavarların gücü %50 azaltıldı: attack ve defense 1x (eski 2x'dan düşürüldü) self.attack = Math.round((10 + type * 2 * powerScale) * 1); self.defense = Math.round((10 + type * 2 * powerScale) * 1); self.maxHP = Math.round(50 + type * 10 * powerScale); self.hp = self.maxHP; self.reward = Math.round(100 + (type - 1) * 100 * powerScale); // Not: Saldırı ve savunma 1x olarak ayarlandı (eski 2x'dan %50 azaltıldı) }; // Update health bar position and width if (self.hpBar && self.sprite) { // Keep bar above sprite self.hpBarBg.x = 0; self.hpBarBg.y = -self.sprite.height / 2 - 18; self.hpBar.x = 0; self.hpBar.y = -self.sprite.height / 2 - 18; // Update bar width (min 0) var ratio = Math.max(0, Math.min(1, self.hp / self.maxHP)); self.hpBar.bar.width = self.sprite.width * 0.88 * ratio; // Optionally, tint bar color based on health if (ratio > 0.5) { self.hpBar.bar.color = 0x4caf50; } else if (ratio > 0.2) { self.hpBar.bar.color = 0xffc107; } else { self.hpBar.bar.color = 0xf44336; } } return self; }); // Global lists for soldiers and enemy // Factory: Converts ore and wood to product over time var Factory = Container.expand(function () { var self = Container.call(this); var factorySprite = self.attachAsset('factory', { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // Factory level self.oreBuffer = 0; // ore waiting to be processed self.woodBuffer = 0; // wood waiting to be processed self.foodBuffer = 0; // food waiting to be processed // productBuffer is now an array of 10 product counts self.productBuffer = []; for (var i = 0; i < 10; i++) self.productBuffer[i] = 0; self.processTime = 120; // ticks to process one resource (was 60, now 2x slower) self.processCounter = 0; self.update = function () { // --- HANGAR: Hammaddeleri hangarStock'tan kullan --- // Önce kendi buffer'ından, yoksa hangarStock'tan çek var oreAvailable = self.oreBuffer > 0 ? self.oreBuffer : typeof hangarStock !== "undefined" ? hangarStock.ore : 0; var woodAvailable = self.woodBuffer > 0 ? self.woodBuffer : typeof hangarStock !== "undefined" ? hangarStock.wood : 0; var foodAvailable = self.foodBuffer > 0 ? self.foodBuffer : typeof hangarStock !== "undefined" ? hangarStock.food : 0; if (oreAvailable > 0 && woodAvailable > 0 && foodAvailable > 0) { self.processCounter++; if (self.processCounter >= Math.max(10, self.processTime - (self.level - 1) * 10)) { // Consume 1 of each resource type for production if (self.oreBuffer > 0) self.oreBuffer--;else if (typeof hangarStock !== "undefined" && hangarStock.ore > 0) hangarStock.ore--; if (self.woodBuffer > 0) self.woodBuffer--;else if (typeof hangarStock !== "undefined" && hangarStock.wood > 0) hangarStock.wood--; if (self.foodBuffer > 0) self.foodBuffer--;else if (typeof hangarStock !== "undefined" && hangarStock.food > 0) hangarStock.food--; // Pick a random product type to produce var prodType = Math.floor(Math.random() * 10); self.productBuffer[prodType]++; // --- HANGAR: Ürünleri hangarStock'a da ekle --- if (typeof hangarStock !== "undefined" && hangarStock.product) { hangarStock.product[prodType] = (hangarStock.product[prodType] || 0) + 1; } self.processCounter = 0; if (typeof updateHangarPanelContent === "function") updateHangarPanelContent(); } } else { self.processCounter = 0; } }; return self; }); // Food: Spawns randomly on the game screen var Food = Container.expand(function () { var self = Container.call(this); // Pick a random food image for this food var foodImages = ['food1', 'food2', 'food3', 'food4', 'food5']; var foodImgId = foodImages[Math.floor(Math.random() * foodImages.length)]; var foodSprite = self.attachAsset(foodImgId, { anchorX: 0.5, anchorY: 0.5 }); self.foodType = foodImgId; return self; }); // Mine: Contains ore or wood, can be depleted var Mine = Container.expand(function () { var self = Container.call(this); // Pick a random resource image for this mine (33% ore, 33% wood, 33% food) var resourceImages = ['ore1', 'ore2', 'ore3', 'ore4', 'ore5', 'ore6', 'ore7', 'ore8', 'ore9', 'ore10', 'wood1', 'wood2', 'wood3', 'wood4', 'wood5', 'food1', 'food2', 'food3', 'food4', 'food5']; var resourceImgId = resourceImages[Math.floor(Math.random() * resourceImages.length)]; var mineSprite = self.attachAsset(resourceImgId, { anchorX: 0.5, anchorY: 0.5 }); self.ore = 10; // initial resource amount self.resourceType = resourceImgId.startsWith('wood') ? 'wood' : resourceImgId.startsWith('food') ? 'food' : 'ore'; // determine if this is wood, food, or ore self.setOre = function (amount) { self.ore = amount; }; return self; }); // Add level to Miner (worker) var Miner = Container.expand(function () { var self = Container.call(this); // Miner visual var minerImages = ['miner1', 'miner2', 'miner3', 'miner4', 'miner5']; var minerImgId = minerImages[Math.floor(Math.random() * minerImages.length)]; var minerSprite = self.attachAsset(minerImgId, { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // Worker level self.speed = 6; // px per tick self.state = 'idle'; // 'idle', 'toMine', 'mining', 'toFactory', 'toShop' self.target = null; // {x, y} self.carrying = null; // 'ore' or 'product' or null self.mineTarget = null; // reference to Mine self.factoryTarget = null; // reference to Factory // Mining animation state self.miningTicks = 0; self.miningDuration = 240; // 4 seconds at 60fps (ores are mined 100% slower, now 2x slower) self.pickaxeIcon = null; // Set miner to go to a mine self.goToMine = function (mine) { self.state = 'toMine'; self.target = { x: mine.x, y: mine.y }; self.mineTarget = mine; }; // Set miner to go to factory self.goToFactory = function (factory) { self.state = 'toFactory'; self.target = { x: factory.x, y: factory.y }; self.factoryTarget = factory; }; // Set miner to idle self.setIdle = function () { self.state = 'idle'; self.target = null; self.mineTarget = null; self.factoryTarget = null; self.miningTicks = 0; if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } }; // Move towards target self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = (self.speed + (self.level - 1) * 1) * getMoveMultiplier(self.level); if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; // Called every tick self.update = function () { if (self.state === 'toMine' && self.mineTarget) { if (self.moveTowards(self.mineTarget.x, self.mineTarget.y)) { // Arrived at mine if (self.mineTarget.ore > 0 && !self.carrying) { // Start mining animation self.state = 'mining'; self.miningTicks = 0; // Add pickaxe icon if not present if (!self.pickaxeIcon) { self.pickaxeIcon = LK.getAsset('pickaxe', { anchorX: 0.5, anchorY: 1.2, x: 0, y: -60 }); self.addChild(self.pickaxeIcon); } // Animate pickaxe (simple up-down) tween(self.pickaxeIcon, { y: -80 }, { duration: 200, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 200, easing: tween.cubicInOut }); } } }); } else { self.setIdle(); } } } else if (self.state === 'mining' && self.mineTarget) { self.miningTicks++; // Animate pickaxe every 20 ticks if (self.pickaxeIcon && self.miningTicks % 20 === 0) { tween(self.pickaxeIcon, { y: -80 }, { duration: 100, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 100, easing: tween.cubicInOut }); } } }); } if (self.miningTicks >= Math.max(10, self.miningDuration - (self.level - 1) * 10)) { if (self.mineTarget.ore > 0 && !self.carrying) { self.mineTarget.ore--; self.carrying = self.mineTarget.resourceType; // carry 'ore' or 'wood' based on mine type if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } // En yakın fabrikayı bul ve oraya git var nearestFactory = null; var nearestDist = Infinity; for (var f = 0; f < factoryList.length; f++) { var fx = factoryList[f].x; var fy = factoryList[f].y; var dx = fx - self.x; var dy = fy - self.y; var dist = dx * dx + dy * dy; if (dist < nearestDist) { nearestDist = dist; nearestFactory = factoryList[f]; } } if (nearestFactory) { self.goToFactory(nearestFactory); } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'toFactory' && self.factoryTarget) { if (self.moveTowards(self.factoryTarget.x, self.factoryTarget.y)) { // Arrived at factory if (self.carrying === 'ore') { self.carrying = null; self.factoryTarget.oreBuffer++; if (self._transferToFactory && self._transferType === 'ore') { // Ore transferi başlatıldıysa, şimdi ore alıp diğer fabrikaya götür self.carrying = 'ore'; self.factoryTarget.oreBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else if (self.carrying === 'wood') { self.carrying = null; self.factoryTarget.woodBuffer++; self.setIdle(); } else if (self.carrying === 'food') { self.carrying = null; self.factoryTarget.foodBuffer++; self.setIdle(); } else if (self._transferToFactory && self._transferType === 'ore') { // Ore transferi için ilk varış, ore al ve diğer fabrikaya git if (self.factoryTarget.oreBuffer > 0) { self.carrying = 'ore'; self.factoryTarget.oreBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'idle') { // Find nearest mine with ore only (not wood or food) var bestMine = null; var bestDist = Infinity; for (var i = 0; i < mineList.length; i++) { var m = mineList[i]; if (m.ore > 0 && m.resourceType === 'ore') { var dx = m.x - self.x; var dy = m.y - self.y; var d = dx * dx + dy * dy; if (d < bestDist) { bestDist = d; bestMine = m; } } } if (bestMine) { self.goToMine(bestMine); } else { // --- Fabrikalar arası eksik hammaddeyi eşitlemek için getir götür --- // Sadece idle ise ve üzerinde yük yoksa // Sadece 'ore' için var fromFactory = null; var toFactory = null; var maxBuffer = -1; var minBuffer = 999999; // Farklı fabrikalar arasında en çok ve en az oreBuffer olanı bul for (var i = 0; i < factoryList.length; i++) { if (factoryList[i].oreBuffer > maxBuffer) { maxBuffer = factoryList[i].oreBuffer; fromFactory = factoryList[i]; } if (factoryList[i].oreBuffer < minBuffer) { minBuffer = factoryList[i].oreBuffer; toFactory = factoryList[i]; } } // Eğer fark 2 veya daha fazlaysa ve fromFactory'de en az 1 ore varsa taşı if (fromFactory && toFactory && fromFactory !== toFactory && maxBuffer - minBuffer >= 2 && fromFactory.oreBuffer > 0) { // Madenci, fromFactory'ye gidip ore alacak self.state = 'toFactory'; self.target = { x: fromFactory.x, y: fromFactory.y }; self.factoryTarget = fromFactory; self.carrying = null; // Taşıma işlemi: fromFactory'ye varınca ore alacak, sonra toFactory'ye götürecek self._transferToFactory = toFactory; self._transferType = 'ore'; } } } }; return self; }); // Oduncu: Collects wood from mines with resourceType 'wood' only var Oduncu = Container.expand(function () { var self = Container.call(this); // Oduncu visual var oduncuImages = ['oduncu1', 'oduncu2', 'oduncu3', 'oduncu4', 'oduncu5']; var oduncuImgId = oduncuImages[Math.floor(Math.random() * oduncuImages.length)]; var oduncuSprite = self.attachAsset(oduncuImgId, { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // Worker level self.speed = 6; // px per tick self.state = 'idle'; // 'idle', 'toMine', 'mining', 'toFactory', 'toShop' self.target = null; // {x, y} self.carrying = null; // 'wood' or 'product' or null self.mineTarget = null; // reference to Mine self.factoryTarget = null; // reference to Factory // Mining animation state self.miningTicks = 0; self.miningDuration = 240; // 4 seconds at 60fps (ores are mined 100% slower, now 2x slower) self.pickaxeIcon = null; // Set oduncu to go to a mine self.goToMine = function (mine) { self.state = 'toMine'; self.target = { x: mine.x, y: mine.y }; self.mineTarget = mine; }; // Set oduncu to go to factory self.goToFactory = function (factory) { self.state = 'toFactory'; self.target = { x: factory.x, y: factory.y }; self.factoryTarget = factory; }; // Set oduncu to idle self.setIdle = function () { self.state = 'idle'; self.target = null; self.mineTarget = null; self.factoryTarget = null; self.miningTicks = 0; if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } }; // Move towards target self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = (self.speed + (self.level - 1) * 1) * getMoveMultiplier(self.level); if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; // Called every tick self.update = function () { if (self.state === 'toMine' && self.mineTarget) { if (self.moveTowards(self.mineTarget.x, self.mineTarget.y)) { // Arrived at mine if (self.mineTarget.ore > 0 && !self.carrying) { // Start mining animation self.state = 'mining'; self.miningTicks = 0; // Add pickaxe icon if not present if (!self.pickaxeIcon) { self.pickaxeIcon = LK.getAsset('pickaxe', { anchorX: 0.5, anchorY: 1.2, x: 0, y: -60 }); self.addChild(self.pickaxeIcon); } // Animate pickaxe (simple up-down) tween(self.pickaxeIcon, { y: -80 }, { duration: 200, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 200, easing: tween.cubicInOut }); } } }); } else { self.setIdle(); } } } else if (self.state === 'mining' && self.mineTarget) { self.miningTicks++; // Animate pickaxe every 20 ticks if (self.pickaxeIcon && self.miningTicks % 20 === 0) { tween(self.pickaxeIcon, { y: -80 }, { duration: 100, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 100, easing: tween.cubicInOut }); } } }); } if (self.miningTicks >= Math.max(10, self.miningDuration - (self.level - 1) * 10)) { if (self.mineTarget.ore > 0 && !self.carrying) { self.mineTarget.ore--; self.carrying = self.mineTarget.resourceType; // carry 'ore' or 'wood' based on mine type if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } // En yakın fabrikayı bul ve oraya git var nearestFactory = null; var nearestDist = Infinity; for (var f = 0; f < factoryList.length; f++) { var fx = factoryList[f].x; var fy = factoryList[f].y; var dx = fx - self.x; var dy = fy - self.y; var dist = dx * dx + dy * dy; if (dist < nearestDist) { nearestDist = dist; nearestFactory = factoryList[f]; } } if (nearestFactory) { self.goToFactory(nearestFactory); } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'toFactory' && self.factoryTarget) { if (self.moveTowards(self.factoryTarget.x, self.factoryTarget.y)) { // Arrived at factory if (self.carrying === 'ore') { self.carrying = null; self.factoryTarget.oreBuffer++; self.setIdle(); } else if (self.carrying === 'wood') { self.carrying = null; self.factoryTarget.woodBuffer++; if (self._transferToFactory && self._transferType === 'wood') { // Wood transferi başlatıldıysa, şimdi wood alıp diğer fabrikaya götür self.carrying = 'wood'; self.factoryTarget.woodBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else if (self.carrying === 'food') { self.carrying = null; self.factoryTarget.foodBuffer++; self.setIdle(); } else if (self._transferToFactory && self._transferType === 'wood') { // Wood transferi için ilk varış, wood al ve diğer fabrikaya git if (self.factoryTarget.woodBuffer > 0) { self.carrying = 'wood'; self.factoryTarget.woodBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'idle') { // Find nearest mine with wood only (not ore or food) var bestMine = null; var bestDist = Infinity; for (var i = 0; i < mineList.length; i++) { var m = mineList[i]; if (m.ore > 0 && m.resourceType === 'wood') { var dx = m.x - self.x; var dy = m.y - self.y; var d = dx * dx + dy * dy; if (d < bestDist) { bestDist = d; bestMine = m; } } } if (bestMine) { self.goToMine(bestMine); } else { // --- Fabrikalar arası eksik odunu eşitlemek için getir götür --- // Sadece idle ise ve üzerinde yük yoksa // Sadece 'wood' için var fromFactory = null; var toFactory = null; var maxBuffer = -1; var minBuffer = 999999; // Farklı fabrikalar arasında en çok ve en az woodBuffer olanı bul for (var i = 0; i < factoryList.length; i++) { if (factoryList[i].woodBuffer > maxBuffer) { maxBuffer = factoryList[i].woodBuffer; fromFactory = factoryList[i]; } if (factoryList[i].woodBuffer < minBuffer) { minBuffer = factoryList[i].woodBuffer; toFactory = factoryList[i]; } } // Eğer fark 2 veya daha fazlaysa ve fromFactory'de en az 1 wood varsa taşı if (fromFactory && toFactory && fromFactory !== toFactory && maxBuffer - minBuffer >= 2 && fromFactory.woodBuffer > 0) { // Oduncu, fromFactory'ye gidip wood alacak self.state = 'toFactory'; self.target = { x: fromFactory.x, y: fromFactory.y }; self.factoryTarget = fromFactory; self.carrying = null; // Taşıma işlemi: fromFactory'ye varınca wood alacak, sonra toFactory'ye götürecek self._transferToFactory = toFactory; self._transferType = 'wood'; } } } }; return self; }); // Researcher: When a mine is depleted, finds a new mine location and spawns it var Researcher = Container.expand(function () { var self = Container.call(this); // Visual for researcher var researcherSprite = self.attachAsset('miner', { anchorX: 0.5, anchorY: 0.5 }); researcherSprite.tint = 0x1a8ffc; // blue tint for distinction self.speed = 5; self.state = 'idle'; // 'idle', 'moving', 'researching' self.target = null; self.researchTicks = 0; self.researchDuration = 90; // 1.5 seconds self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = self.speed * getMoveMultiplier(1); // Researchers have no level, always use 1 if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; self.startResearch = function (tx, ty) { self.state = 'moving'; self.target = { x: tx, y: ty }; self.researchTicks = 0; }; self.update = function () { if (self.state === 'moving' && self.target) { if (self.moveTowards(self.target.x, self.target.y)) { // If we just finished research, set to idle after returning to start if (self.researchTicks >= self.researchDuration) { self.state = 'idle'; self.target = null; self.researchTicks = 0; } else { self.state = 'researching'; self.researchTicks = 0; } } } else if (self.state === 'researching') { self.researchTicks++; if (self.researchTicks >= self.researchDuration) { // Spawn new mine at this location var mine = new Mine(); mine.x = self.x; mine.y = self.y; mineList.push(mine); game.addChild(mine); // After finding ore, move researcher to starting position and wait there self.state = 'moving'; self.target = { x: 1024, // worker start image x y: 2400 // worker start image y }; } } else if (self.state === 'idle') { // --- Yeni: Stokta en az olan hammaddeyi bulup ona öncelik ver --- // Her fabrika için oreBuffer, woodBuffer, foodBuffer toplamlarını hesapla var oreTotal = 0, woodTotal = 0, foodTotal = 0; for (var i = 0; i < factoryList.length; i++) { oreTotal += factoryList[i].oreBuffer || 0; woodTotal += factoryList[i].woodBuffer || 0; foodTotal += factoryList[i].foodBuffer || 0; } // Hangi hammadde en azsa onu bul var minVal = Math.min(oreTotal, woodTotal, foodTotal); var minTypes = []; if (oreTotal === minVal) minTypes.push('ore'); if (woodTotal === minVal) minTypes.push('wood'); if (foodTotal === minVal) minTypes.push('food'); // Eğer birden fazla eşitse rastgele seç var targetType = minTypes[Math.floor(Math.random() * minTypes.length)]; // O tipten haritada kaç tane var? var oreCount = 0, woodCount = 0, foodCount = 0; for (var i = 0; i < mineList.length; i++) { if (mineList[i].resourceType === 'ore') oreCount++; if (mineList[i].resourceType === 'wood') woodCount++; if (mineList[i].resourceType === 'food') foodCount++; } var treeCount = treeList.length; // Her tip için maksimum 4 tane olsun var needOre = targetType === 'ore' && oreCount < 4; var needWood = targetType === 'wood' && treeCount < 4; var needFood = targetType === 'food' && foodCount < 4; if (needOre || needWood || needFood) { // Yeni madenin tipine göre random bir konum seç var tx = 300 + Math.random() * 1400; var ty = 600 + Math.random() * 600; self.startResearch(tx, ty); } } }; return self; }); // Shop: Holds products for sale, customers come to buy var Shop = Container.expand(function () { var self = Container.call(this); var shopSprite = self.attachAsset('shop', { anchorX: 0.5, anchorY: 0.5 }); // productBuffer is now an array of 10 product counts self.productBuffer = []; for (var i = 0; i < 10; i++) self.productBuffer[i] = 0; self.level = 1; return self; }); // --- SOLDIER CLASS --- var Soldier = Container.expand(function () { var self = Container.call(this); // type: 'yaya', 'okcu', 'mizrakci', 'zirhli', 'atli' self.soldierType = 'yaya'; self.state = 'idle'; // 'idle', 'moving', 'fighting', 'returning' self.targetEnemy = null; self.targetPos = null; self.lastX = 0; self.lastY = 0; self.lastWasIntersecting = false; self.attack = 1; self.defense = 1; self.speed = 3; self.reward = 0; self.sprite = null; self.setType = function (type) { self.soldierType = type; var assetId = 'soldier_' + type; if (self.sprite) self.sprite.destroy(); self.sprite = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); // Set stats with 1.5x power scaling if (type === 'yaya') { self.attack = 10; self.defense = 8; self.speed = 3; } else if (type === 'okcu') { // 1.5x stronger than yaya: (10+8) * 1.5 = 27 total power self.attack = 15; self.defense = 12; self.speed = 3.5; } else if (type === 'mizrakci') { // 1.5x stronger than okcu: 27 * 1.5 = 40.5 total power self.attack = 22; self.defense = 18; self.speed = 3; } else if (type === 'zirhli') { // 1.5x stronger than mizrakci: 40 * 1.5 = 60 total power self.attack = 33; self.defense = 27; self.speed = 2.2; } else if (type === 'atli') { // 1.5x stronger than zirhli: 60 * 1.5 = 90 total power self.attack = 50; self.defense = 40; self.speed = 4.2; } }; self.goTo = function (x, y) { self.state = 'moving'; self.targetPos = { x: x, y: y }; }; self.returnToHQ = function () { // Karargah binasına dön self.state = 'returning'; self.targetPos = { x: karargahImg.x, y: karargahImg.y + 80 }; }; self.update = function () { if (self.state === 'idle') return; if (self.state === 'moving' && self.targetPos) { var dx = self.targetPos.x - self.x; var dy = self.targetPos.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < self.speed) { self.x = self.targetPos.x; self.y = self.targetPos.y; if (self.targetEnemy) { self.state = 'fighting'; } else { self.state = 'idle'; } } else { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } } else if (self.state === 'fighting' && self.targetEnemy) { // Fight logic handled in game.update } else if (self.state === 'returning' && self.targetPos) { var dx = self.targetPos.x - self.x; var dy = self.targetPos.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < self.speed) { self.x = self.targetPos.x; self.y = self.targetPos.y; self.state = 'idle'; } else { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } } self.lastX = self.x; self.lastY = self.y; }; return self; }); // Toplayıcı: Collects food from mines with resourceType 'food' only var Toplayici = Container.expand(function () { var self = Container.call(this); // Toplayıcı visual var toplayiciImages = ['toplayici1', 'toplayici2', 'toplayici3', 'toplayici4', 'toplayici5']; var toplayiciImgId = toplayiciImages[Math.floor(Math.random() * toplayiciImages.length)]; var toplayiciSprite = self.attachAsset(toplayiciImgId, { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; // Worker level self.speed = 6; // px per tick self.state = 'idle'; // 'idle', 'toMine', 'mining', 'toFactory', 'toShop' self.target = null; // {x, y} self.carrying = null; // 'food' or 'product' or null self.mineTarget = null; // reference to Mine self.factoryTarget = null; // reference to Factory // Mining animation state self.miningTicks = 0; self.miningDuration = 240; // 4 seconds at 60fps (ores are mined 100% slower, now 2x slower) self.pickaxeIcon = null; // Set toplayıcı to go to a mine self.goToMine = function (mine) { self.state = 'toMine'; self.target = { x: mine.x, y: mine.y }; self.mineTarget = mine; }; // Set toplayıcı to go to factory self.goToFactory = function (factory) { self.state = 'toFactory'; self.target = { x: factory.x, y: factory.y }; self.factoryTarget = factory; }; // Set toplayıcı to idle self.setIdle = function () { self.state = 'idle'; self.target = null; self.mineTarget = null; self.factoryTarget = null; self.miningTicks = 0; if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } }; // Move towards target self.moveTowards = function (tx, ty) { var dx = tx - self.x; var dy = ty - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var moveSpeed = (self.speed + (self.level - 1) * 1) * getMoveMultiplier(self.level); if (dist < moveSpeed) { self.x = tx; self.y = ty; return true; } self.x += dx / dist * moveSpeed; self.y += dy / dist * moveSpeed; return false; }; // Called every tick self.update = function () { if (self.state === 'toMine' && self.mineTarget) { if (self.moveTowards(self.mineTarget.x, self.mineTarget.y)) { // Arrived at mine if (self.mineTarget.ore > 0 && !self.carrying) { // Start mining animation self.state = 'mining'; self.miningTicks = 0; // Add pickaxe icon if not present if (!self.pickaxeIcon) { self.pickaxeIcon = LK.getAsset('pickaxe', { anchorX: 0.5, anchorY: 1.2, x: 0, y: -60 }); self.addChild(self.pickaxeIcon); } // Animate pickaxe (simple up-down) tween(self.pickaxeIcon, { y: -80 }, { duration: 200, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 200, easing: tween.cubicInOut }); } } }); } else { self.setIdle(); } } } else if (self.state === 'mining' && self.mineTarget) { self.miningTicks++; // Animate pickaxe every 20 ticks if (self.pickaxeIcon && self.miningTicks % 20 === 0) { tween(self.pickaxeIcon, { y: -80 }, { duration: 100, easing: tween.cubicInOut, onFinish: function onFinish() { if (self.pickaxeIcon) { tween(self.pickaxeIcon, { y: -60 }, { duration: 100, easing: tween.cubicInOut }); } } }); } if (self.miningTicks >= Math.max(10, self.miningDuration - (self.level - 1) * 10)) { if (self.mineTarget.ore > 0 && !self.carrying) { self.mineTarget.ore--; self.carrying = self.mineTarget.resourceType; // carry 'ore' or 'wood' based on mine type if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } // En yakın fabrikayı bul ve oraya git var nearestFactory = null; var nearestDist = Infinity; for (var f = 0; f < factoryList.length; f++) { var fx = factoryList[f].x; var fy = factoryList[f].y; var dx = fx - self.x; var dy = fy - self.y; var dist = dx * dx + dy * dy; if (dist < nearestDist) { nearestDist = dist; nearestFactory = factoryList[f]; } } if (nearestFactory) { self.goToFactory(nearestFactory); } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'toFactory' && self.factoryTarget) { if (self.moveTowards(self.factoryTarget.x, self.factoryTarget.y)) { // Arrived at factory if (self.carrying === 'ore') { self.carrying = null; self.factoryTarget.oreBuffer++; self.setIdle(); } else if (self.carrying === 'wood') { self.carrying = null; self.factoryTarget.woodBuffer++; self.setIdle(); } else if (self.carrying === 'food') { self.carrying = null; self.factoryTarget.foodBuffer++; if (self._transferToFactory && self._transferType === 'food') { // Food transferi başlatıldıysa, şimdi food alıp diğer fabrikaya götür self.carrying = 'food'; self.factoryTarget.foodBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else if (self._transferToFactory && self._transferType === 'food') { // Food transferi için ilk varış, food al ve diğer fabrikaya git if (self.factoryTarget.foodBuffer > 0) { self.carrying = 'food'; self.factoryTarget.foodBuffer--; var dest = self._transferToFactory; self.state = 'toFactory'; self.target = { x: dest.x, y: dest.y }; self.factoryTarget = dest; self._transferToFactory = null; self._transferType = null; } else { self.setIdle(); } } else { self.setIdle(); } } } else if (self.state === 'idle') { // Find nearest mine with food only (not ore or wood) var bestMine = null; var bestDist = Infinity; for (var i = 0; i < mineList.length; i++) { var m = mineList[i]; if (m.ore > 0 && m.resourceType === 'food') { var dx = m.x - self.x; var dy = m.y - self.y; var d = dx * dx + dy * dy; if (d < bestDist) { bestDist = d; bestMine = m; } } } if (bestMine) { self.goToMine(bestMine); } else { // --- Fabrikalar arası eksik yiyeceği eşitlemek için getir götür --- // Sadece idle ise ve üzerinde yük yoksa // Sadece 'food' için var fromFactory = null; var toFactory = null; var maxBuffer = -1; var minBuffer = 999999; // Farklı fabrikalar arasında en çok ve en az foodBuffer olanı bul for (var i = 0; i < factoryList.length; i++) { if (factoryList[i].foodBuffer > maxBuffer) { maxBuffer = factoryList[i].foodBuffer; fromFactory = factoryList[i]; } if (factoryList[i].foodBuffer < minBuffer) { minBuffer = factoryList[i].foodBuffer; toFactory = factoryList[i]; } } // Eğer fark 2 veya daha fazlaysa ve fromFactory'de en az 1 food varsa taşı if (fromFactory && toFactory && fromFactory !== toFactory && maxBuffer - minBuffer >= 2 && fromFactory.foodBuffer > 0) { // Toplayıcı, fromFactory'ye gidip food alacak self.state = 'toFactory'; self.target = { x: fromFactory.x, y: fromFactory.y }; self.factoryTarget = fromFactory; self.carrying = null; // Taşıma işlemi: fromFactory'ye varınca food alacak, sonra toFactory'ye götürecek self._transferToFactory = toFactory; self._transferType = 'food'; } } } }; return self; }); // ÇALIŞANLAR PANELİ başlık, buton ve sayıları başta gizle // No background, no music, no sound, as per requirements // End of MVP code; // Tree: Spawns randomly on the game screen var Tree = Container.expand(function () { var self = Container.call(this); // Pick a random tree image for this tree var treeImages = ['wood1', 'wood2', 'wood3', 'wood4', 'wood5']; var treeImgId = treeImages[Math.floor(Math.random() * treeImages.length)]; var treeSprite = self.attachAsset(treeImgId, { anchorX: 0.5, anchorY: 0.5 }); self.treeType = treeImgId; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Add a background image to the game // Soldier assets // Enemy assets (10 types) // Global lists for soldiers and enemy var soldierList = []; var currentEnemy = null; var lastEnemyDefeatedTime = 0; // --- KERVAN SİSTEMİ: GELİŞMİŞ TİCARET PANELİ ve LOJİSTİK --- // Kervan state değişkenleri var caravan = null; var caravanActive = false; var caravanArrived = false; var caravanPanelOpen = false; var caravanTradeMade = false; var caravanTimeout = null; var caravanNextArrivalTick = 0; var caravanStock = null; var caravanProductRows = []; var caravanPanelBg, caravanPanelTitle, caravanPanelContent, caravanPanelCloseIcon; var caravanPanelSellRows = []; var caravanPanelTimer = null; var caravanLeaveTick = 0; var caravanArriveTargetX = 0, caravanArriveTargetY = 0; var caravanDepoTargetX = 0, caravanDepoTargetY = 0; // Kervan stoğu oluşturucu function generateCaravanStock() { // Hammaddeler: min 5, max 30 var ore = 5 + Math.floor(Math.random() * 26); var wood = 5 + Math.floor(Math.random() * 26); var food = 5 + Math.floor(Math.random() * 26); // Ürünlerden rastgele 5 çeşit, her biri 1-20 arası var productStock = []; var productIndexes = []; for (var i = 0; i < productTypes.length; i++) productIndexes.push(i); // Karıştır for (var i = productIndexes.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var tmp = productIndexes[i]; productIndexes[i] = productIndexes[j]; productIndexes[j] = tmp; } var selectedProducts = productIndexes.slice(0, 5); for (var i = 0; i < productTypes.length; i++) productStock[i] = 0; for (var i = 0; i < selectedProducts.length; i++) { productStock[selectedProducts[i]] = 1 + Math.floor(Math.random() * 20); } return { ore: ore, wood: wood, food: food, product: productStock }; } // Kervan panelini oluştur (ilk seferde bir kez) function createCaravanPanel() { if (caravanPanelBg) return; caravanPanelBg = LK.getAsset('caravanPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, scaleX: 1.1, scaleY: 1.1 }); caravanPanelBg.alpha = 0.97; caravanPanelBg.visible = false; game.addChild(caravanPanelBg); caravanPanelTitle = new Text2('Kervan', { size: 38, fill: "#000", fontWeight: "bold" }); caravanPanelTitle.anchor.set(0.5, 0.5); caravanPanelTitle.x = caravanPanelBg.x; caravanPanelTitle.y = caravanPanelBg.y - caravanPanelBg.height / 2 + 60; caravanPanelTitle.visible = false; game.addChild(caravanPanelTitle); caravanPanelContent = new Container(); caravanPanelContent.x = caravanPanelBg.x; // YAZI ve İŞLEVLERİ %25 yukarı taşı (arka plan sabit kalacak) // Panel içeriği normalde arka planın ortasında, -30 offset ile. Şimdi %25 yukarı taşıyoruz. caravanPanelContent.y = caravanPanelBg.y - 30 - caravanPanelBg.height * 0.25; caravanPanelContent.visible = false; game.addChild(caravanPanelContent); // Kapat ikonu caravanPanelCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); caravanPanelCloseIcon.anchor.set(0.5, 0.5); caravanPanelCloseIcon.x = caravanPanelBg.x + caravanPanelBg.width / 2 - 30; caravanPanelCloseIcon.y = caravanPanelBg.y - caravanPanelBg.height / 2 + 30; caravanPanelCloseIcon.visible = false; game.addChild(caravanPanelCloseIcon); caravanPanelCloseIcon.down = function () { toggleCaravanPanel(false); }; } // Kervan panelini aç/kapat ve güncelle function toggleCaravanPanel(forceOpen) { var newVisible = typeof forceOpen === "boolean" ? forceOpen : !caravanPanelBg.visible; // Paneli en ön planda açmak için zIndex'i en yükseğe ayarla if (caravanPanelBg && typeof caravanPanelBg.setIndex === "function") { caravanPanelBg.setIndex(9999); } if (caravanPanelTitle && typeof caravanPanelTitle.setIndex === "function") { caravanPanelTitle.setIndex(9999); } if (caravanPanelCloseIcon && typeof caravanPanelCloseIcon.setIndex === "function") { caravanPanelCloseIcon.setIndex(9999); } if (caravanPanelContent && typeof caravanPanelContent.setIndex === "function") { caravanPanelContent.setIndex(9999); } caravanPanelBg.visible = newVisible; caravanPanelTitle.visible = newVisible; caravanPanelCloseIcon.visible = newVisible; caravanPanelContent.visible = newVisible; caravanPanelOpen = newVisible; // Panel açılırsa kalan süreyi sıfırla if (newVisible) { // Paneli ortala if (caravanPanelBg) { caravanPanelBg.x = 2048 / 2; caravanPanelBg.y = 2732 / 2; } if (caravanPanelTitle) { caravanPanelTitle.x = 2048 / 2; caravanPanelTitle.y = 2732 / 2 - (caravanPanelBg ? caravanPanelBg.height / 2 : 0) + 60; } if (caravanPanelContent) { caravanPanelContent.x = 2048 / 2; // YAZI ve İŞLEVLERİ %25 yukarı taşı (arka plan sabit kalacak) caravanPanelContent.y = 2732 / 2 - 30 - (caravanPanelBg ? caravanPanelBg.height * 0.25 : 0); } if (caravanPanelCloseIcon) { caravanPanelCloseIcon.x = 2048 / 2 + (caravanPanelBg ? caravanPanelBg.width / 2 : 0) - 30; caravanPanelCloseIcon.y = 2732 / 2 - (caravanPanelBg ? caravanPanelBg.height / 2 : 0) + 30; } // Panel arka planını yazının en altına kadar uzat if (caravanPanelBg && caravanPanelContent && caravanPanelContent.children.length > 0) { // Son satırın y'sini bul var lastChild = caravanPanelContent.children[caravanPanelContent.children.length - 1]; var contentBottom = lastChild.y + (lastChild.height ? lastChild.height / 2 : 0); var panelTop = caravanPanelBg.y - caravanPanelBg.height / 2; var panelBottom = panelTop + caravanPanelBg.height; var desiredHeight = contentBottom + 60; // 60px alt boşluk var newHeight = Math.max(caravanPanelBg.height, desiredHeight); caravanPanelBg.height = newHeight; // Panel başlığını ve kapat ikonunu yeni yüksekliğe göre hizala if (caravanPanelTitle) { caravanPanelTitle.y = caravanPanelBg.y - newHeight / 2 + 60; } if (caravanPanelCloseIcon) { caravanPanelCloseIcon.y = caravanPanelBg.y - newHeight / 2 + 30; } } caravanLeaveTick = LK.ticks + 3600; // 1 dakika sonra ayrılacak (60*60) updateCaravanPanelRows(); } // Panel kapatılırsa, ana ekranı göster if (!newVisible) { showMainPageElements(true); } } // Ana sayfa elemanlarını göster/gizle function showMainPageElements(show) { karargahImg.visible = show; karargahLabel.visible = show; workerStartImg.visible = show; kampimizLabel.visible = show; researchCampImg.visible = show; researchCampLabel.visible = show; researchCampRightImg.visible = show; workerPanelLabel.visible = show; workerPanelTopImg.visible = show; depoLabel.visible = show; if (city) city.visible = show; for (var i = 0; i < minerList.length; i++) minerList[i].visible = show; for (var i = 0; i < carrierList.length; i++) carrierList[i].visible = show; for (var i = 0; i < researcherList.length; i++) researcherList[i].visible = show; for (var i = 0; i < oduncuList.length; i++) oduncuList[i].visible = show; for (var i = 0; i < toplayiciList.length; i++) toplayiciList[i].visible = show; for (var i = 0; i < customerList.length; i++) customerList[i].visible = show; for (var i = 0; i < mineList.length; i++) mineList[i].visible = show; for (var i = 0; i < factoryList.length; i++) factoryList[i].visible = show; for (var i = 0; i < shopList.length; i++) shopList[i].visible = show; for (var i = 0; i < soldierList.length; i++) soldierList[i].visible = show; for (var i = 0; i < treeList.length; i++) treeList[i].visible = show; for (var i = 0; i < foodList.length; i++) foodList[i].visible = show; if (currentEnemy) currentEnemy.visible = show; for (var i = 0; i < statusTexts.length; i++) statusTexts[i].visible = show; } // Kervan panel satırlarını güncelle function updateCaravanPanelRows() { // Paneli temizle while (caravanPanelContent.children.length > 0) { var c = caravanPanelContent.children[0]; c.destroy && c.destroy(); caravanPanelContent.removeChild(c); } caravanProductRows = []; caravanPanelSellRows = []; var y = 0; var rowHeight = 80; var colLabelX = -caravanPanelBg.width * 0.35; var colValueX = 0; var colBtnX = caravanPanelBg.width * 0.35 - 30; // --- Kervan geldiğinde kalan süreyi gösteren sayaç ekle --- if (caravanArrived && caravanLeaveTick > LK.ticks) { var ticksLeft = caravanLeaveTick - LK.ticks; var secondsLeft = Math.ceil(ticksLeft / 60); var min = Math.floor(secondsLeft / 60); var sec = secondsLeft % 60; var timeStr = min + "dk " + (sec < 10 ? "0" : "") + sec + "sn"; var caravanTimerTxt = new Text2("Kervan gidecek: " + timeStr, { size: 32, fill: 0xD32F2F, fontWeight: "bold" }); caravanTimerTxt.anchor.set(0.5, 0.5); caravanTimerTxt.x = 0; caravanTimerTxt.y = y + 10; caravanPanelContent.addChild(caravanTimerTxt); y += rowHeight - 40; // Sayaç için biraz daha az boşluk bırak } // --- Kervandan AL (hammadde ve ürünler) --- // Hammaddeler var matList = [{ key: "ore", label: "Cevher", price: Math.round(productTypes[0].price * 1.1) }, { key: "wood", label: "Odun", price: Math.round(productTypes[1].price * 1.1) }, { key: "food", label: "Yiyecek", price: Math.round(productTypes[2].price * 1.1) }]; for (var i = 0; i < matList.length; i++) { var mat = matList[i]; var rowBg = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: caravanPanelBg.width * 0.85, height: rowHeight - 10, color: 0xf5f5f5, shape: 'box', x: 0, y: y }); rowBg.alpha = 0.85; caravanPanelContent.addChild(rowBg); var labelTxt = new Text2(mat.label + ":", { size: 32, fill: "#000", fontWeight: "bold" }); labelTxt.anchor.set(0, 0.5); labelTxt.x = colLabelX; labelTxt.y = y; caravanPanelContent.addChild(labelTxt); var valueTxt = new Text2("" + (caravanStock ? caravanStock[mat.key] : 0), { size: 32, fill: "#333" }); valueTxt.anchor.set(0.5, 0.5); valueTxt.x = colValueX; valueTxt.y = y; caravanPanelContent.addChild(valueTxt); var price = mat.price; var buyBtn = new Text2("Al (₺" + price + ")", { size: 28, fill: 0x2E7D32, fontWeight: "bold" }); buyBtn.anchor.set(1, 0.5); buyBtn.x = colBtnX; buyBtn.y = y; buyBtn.alpha = caravanStock && caravanStock[mat.key] > 0 ? 1 : 0.4; (function (mat, valueTxt, buyBtn) { buyBtn.down = function () { if (caravanStock && caravanStock[mat.key] > 0 && money >= mat.price) { money -= mat.price; updateMoneyText(); caravanStock[mat.key]--; valueTxt.setText("" + caravanStock[mat.key]); buyBtn.alpha = caravanStock[mat.key] <= 0 ? 0.4 : 1; // --- HANGAR: Stoğa ekle --- if (typeof hangarStock !== "undefined") { hangarStock[mat.key] = (hangarStock[mat.key] || 0) + 1; } updateHangarPanelContent && updateHangarPanelContent(); caravanTradeMade = true; } }; })(mat, valueTxt, buyBtn); caravanPanelContent.addChild(buyBtn); caravanProductRows.push({ labelTxt: labelTxt, valueTxt: valueTxt, buyBtn: buyBtn }); y += rowHeight; } // Ürünler (kervandan AL) for (var i = 0; i < productTypes.length; i++) { if (!caravanStock || !caravanStock.product || caravanStock.product[i] <= 0) continue; var rowBg = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: caravanPanelBg.width * 0.85, height: rowHeight - 10, color: 0xf5f5f5, shape: 'box', x: 0, y: y }); rowBg.alpha = 0.85; caravanPanelContent.addChild(rowBg); var labelTxt = new Text2(productTypes[i].name + ":", { size: 32, fill: "#000", fontWeight: "bold" }); labelTxt.anchor.set(0, 0.5); labelTxt.x = colLabelX; labelTxt.y = y; caravanPanelContent.addChild(labelTxt); var valueTxt = new Text2("" + (caravanStock.product[i] || 0), { size: 32, fill: "#333" }); valueTxt.anchor.set(0.5, 0.5); valueTxt.x = colValueX; valueTxt.y = y; caravanPanelContent.addChild(valueTxt); var price = Math.round(productTypes[i].price * 1.1); // Ortalama fiyatı hesapla (örnek: ürünün base fiyatı) var avgPrice = productTypes[i].price; // Kar/zarar oranı hesapla var profitPercent = Math.round((price - avgPrice) / avgPrice * 100); var profitColor = profitPercent > 0 ? "#2E7D32" : profitPercent < 0 ? "#d32f2f" : "#333"; var profitText = profitPercent > 0 ? "Kâr: %" + profitPercent : profitPercent < 0 ? "Zarar: %" + Math.abs(profitPercent) : "Kâr: %0"; var profitTxt = new Text2(profitText, { size: 22, fill: profitColor }); profitTxt.anchor.set(0, 0.5); profitTxt.x = colValueX + 80; profitTxt.y = y; caravanPanelContent.addChild(profitTxt); var buyBtn = new Text2("Al (₺" + price + ")", { size: 28, fill: 0x2E7D32, fontWeight: "bold" }); buyBtn.anchor.set(1, 0.5); buyBtn.x = colBtnX; buyBtn.y = y; buyBtn.alpha = caravanStock.product[i] > 0 ? 1 : 0.4; (function (i, valueTxt, buyBtn) { buyBtn.down = function () { if (caravanStock && caravanStock.product[i] > 0 && money >= price) { money -= price; updateMoneyText(); caravanStock.product[i]--; valueTxt.setText("" + caravanStock.product[i]); buyBtn.alpha = caravanStock.product[i] <= 0 ? 0.4 : 1; // --- HANGAR: Stoğa ekle --- if (typeof hangarStock !== "undefined" && hangarStock.product) { hangarStock.product[i] = (hangarStock.product[i] || 0) + 1; } updateHangarPanelContent && updateHangarPanelContent(); caravanTradeMade = true; } }; })(i, valueTxt, buyBtn); caravanPanelContent.addChild(buyBtn); caravanProductRows.push({ labelTxt: labelTxt, valueTxt: valueTxt, buyBtn: buyBtn, profitTxt: profitTxt }); y += rowHeight; } // --- Kervana SAT (ürün ve hammadde) --- // Satılabilir ürünler: oyuncunun stoğunda olanlar var sellTitle = new Text2("Kervana Satış", { size: 30, fill: 0x1565C0, fontWeight: "bold" }); sellTitle.anchor.set(0.5, 0.5); sellTitle.x = 0; sellTitle.y = y + 30; caravanPanelContent.addChild(sellTitle); y += rowHeight + 30; // Hammaddelerden satılabilenler var playerMats = [{ key: "ore", label: "Cevher", getCount: function getCount() { var total = 0; for (var f = 0; f < factoryList.length; f++) total += factoryList[f].oreBuffer || 0; return total; }, price: Math.round(productTypes[0].price * 0.9) }, { key: "wood", label: "Odun", getCount: function getCount() { var total = 0; for (var f = 0; f < factoryList.length; f++) total += factoryList[f].woodBuffer || 0; return total; }, price: Math.round(productTypes[1].price * 0.9) }, { key: "food", label: "Yiyecek", getCount: function getCount() { var total = 0; for (var f = 0; f < factoryList.length; f++) total += factoryList[f].foodBuffer || 0; return total; }, price: Math.round(productTypes[2].price * 0.9) }]; for (var i = 0; i < playerMats.length; i++) { var mat = playerMats[i]; var rowBg = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: caravanPanelBg.width * 0.85, height: rowHeight - 10, color: 0xe3f2fd, shape: 'box', x: 0, y: y }); rowBg.alpha = 0.85; caravanPanelContent.addChild(rowBg); var labelTxt = new Text2(mat.label + ":", { size: 28, fill: "#000", fontWeight: "bold" }); labelTxt.anchor.set(0, 0.5); labelTxt.x = colLabelX; labelTxt.y = y; caravanPanelContent.addChild(labelTxt); var valueTxt = new Text2("" + mat.getCount(), { size: 28, fill: "#333" }); valueTxt.anchor.set(0.5, 0.5); valueTxt.x = colValueX; valueTxt.y = y; caravanPanelContent.addChild(valueTxt); var price = mat.price; var sellBtn = new Text2("Sat (₺" + price + ")", { size: 24, fill: 0xd32f2f, fontWeight: "bold" }); sellBtn.anchor.set(1, 0.5); sellBtn.x = colBtnX; sellBtn.y = y; sellBtn.alpha = mat.getCount() > 0 ? 1 : 0.4; (function (mat, valueTxt, sellBtn) { sellBtn.down = function () { // Satış: ilk bulduğu fabrikadan 1 adet düş for (var f = 0; f < factoryList.length; f++) { if (factoryList[f][mat.key + "Buffer"] > 0) { factoryList[f][mat.key + "Buffer"]--; money += mat.price; updateMoneyText(); valueTxt.setText("" + mat.getCount()); sellBtn.alpha = mat.getCount() <= 0 ? 0.4 : 1; caravanTradeMade = true; break; } } }; })(mat, valueTxt, sellBtn); caravanPanelContent.addChild(sellBtn); caravanPanelSellRows.push({ labelTxt: labelTxt, valueTxt: valueTxt, sellBtn: sellBtn }); y += rowHeight; } // Ürünlerden satılabilenler for (var i = 0; i < productTypes.length; i++) { // Oyuncunun stoğunda var mı? var total = 0; for (var f = 0; f < factoryList.length; f++) total += factoryList[f].productBuffer[i] || 0; if (total <= 0) continue; var rowBg = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: caravanPanelBg.width * 0.85, height: rowHeight - 10, color: 0xe3f2fd, shape: 'box', x: 0, y: y }); rowBg.alpha = 0.85; caravanPanelContent.addChild(rowBg); var labelTxt = new Text2(productTypes[i].name + ":", { size: 28, fill: "#000", fontWeight: "bold" }); labelTxt.anchor.set(0, 0.5); labelTxt.x = colLabelX; labelTxt.y = y; caravanPanelContent.addChild(labelTxt); var valueTxt = new Text2("" + total, { size: 28, fill: "#333" }); valueTxt.anchor.set(0.5, 0.5); valueTxt.x = colValueX; valueTxt.y = y; caravanPanelContent.addChild(valueTxt); var price = Math.round(productTypes[i].price * 0.9); // Ortalama fiyatı hesapla (örnek: ürünün base fiyatı) var avgPrice = productTypes[i].price; // Kar/zarar oranı hesapla var profitPercent = Math.round((price - avgPrice) / avgPrice * 100); var profitColor = profitPercent > 0 ? "#2E7D32" : profitPercent < 0 ? "#d32f2f" : "#333"; var profitText = profitPercent > 0 ? "Kâr: %" + profitPercent : profitPercent < 0 ? "Zarar: %" + Math.abs(profitPercent) : "Kâr: %0"; var profitTxt = new Text2(profitText, { size: 20, fill: profitColor }); profitTxt.anchor.set(0, 0.5); profitTxt.x = colValueX + 80; profitTxt.y = y; caravanPanelContent.addChild(profitTxt); var sellBtn = new Text2("Sat (₺" + price + ")", { size: 24, fill: 0xd32f2f, fontWeight: "bold" }); sellBtn.anchor.set(1, 0.5); sellBtn.x = colBtnX; sellBtn.y = y; sellBtn.alpha = total > 0 ? 1 : 0.4; (function (i, valueTxt, sellBtn) { sellBtn.down = function () { // Satış: ilk bulduğu fabrikadan 1 adet düş for (var f = 0; f < factoryList.length; f++) { if (factoryList[f].productBuffer[i] > 0) { factoryList[f].productBuffer[i]--; money += price; updateMoneyText(); // Güncelle var total = 0; for (var ff = 0; ff < factoryList.length; ff++) total += factoryList[ff].productBuffer[i] || 0; valueTxt.setText("" + total); sellBtn.alpha = total <= 0 ? 0.4 : 1; caravanTradeMade = true; break; } } }; })(i, valueTxt, sellBtn); caravanPanelContent.addChild(sellBtn); caravanPanelSellRows.push({ labelTxt: labelTxt, valueTxt: valueTxt, sellBtn: sellBtn, profitTxt: profitTxt }); y += rowHeight; } } // Kervan spawn fonksiyonu function spawnCaravan() { if (caravan) { caravan.destroy(); caravan = null; } createCaravanPanel(); caravan = new Caravan(); // Kervan paneli açılmasını garanti et caravan.down = function (x, y, obj) { toggleCaravanPanel(true); showMainPageElements(false); }; // Kervan haritanın orta kısımlarında rastgele bir noktadan başlasın (kenarlardan uzak) // Orta alan: x: 500-1548, y: 700-2000 var spawnX = 500 + Math.random() * 1048; var spawnY = 700 + Math.random() * 1300; caravan.x = spawnX; caravan.y = spawnY; caravan.lastX = caravan.x; caravan.lastY = caravan.y; // Hedef: Haritanın orta kısımlarında rastgele bir yerde dursun (kenarlardan uzak) // Orta alan: x: 600-1448, y: 900-1800 caravanDepoTargetX = 600 + Math.random() * 848; caravanDepoTargetY = 900 + Math.random() * 900; caravanArriveTargetX = caravanDepoTargetX; caravanArriveTargetY = caravanDepoTargetY; game.addChild(caravan); caravanActive = true; caravanArrived = false; caravanPanelOpen = false; caravanTradeMade = false; caravanTimeout = null; caravanStock = generateCaravanStock(); caravanLeaveTick = 0; } // Kervan'a tıklanınca panel aç/kapat function caravanDownHandler() { toggleCaravanPanel(true); showMainPageElements(false); } // Kervan her zaman tıklanabilir olsun (kervanArrived olmasa da) function checkCaravanArrived() { if (!caravan) return; // Hedef: DEPO'nun olduğu yer var targetX = caravanArriveTargetX; var targetY = caravanArriveTargetY; var dx = caravan.x - targetX; var dy = caravan.y - targetY; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < 40) { caravanArrived = true; } // Kervan resmine tıklanınca paneli aç if (caravan) { caravan.down = function (x, y, obj) { toggleCaravanPanel(true); showMainPageElements(false); }; } } // Kervanın ayrılması ve tekrar gelmesi function handleCaravanTimeouts() { // Panel açıksa ve ticaret yapıldıysa, panel kapatılınca 1dk sonra tekrar gelsin if (!caravanActive) return; // Kervan geldikten 1 dakika sonra gitsin ve 2 dakika sonra güncel stok ile geri gelsin // 1. Kervan geldiğinde, 1dk sonra ayrılacak (panel açık veya kapalı farketmez) if (caravanArrived && caravanActive) { // Kervan ayrılma tick'i ayarlanmadıysa ayarla if (caravanLeaveTick === 0) { caravanLeaveTick = LK.ticks + 60 * 60; // 1dk sonra ayrılacak } // 1dk dolduysa kervanı kaldır if (LK.ticks >= caravanLeaveTick) { // Panel açıksa kapat if (caravanPanelOpen) { toggleCaravanPanel(false); showMainPageElements(true); } // Kervanı kaldır if (caravan) { caravan.destroy(); caravan = null; } caravanActive = false; caravanArrived = false; caravanPanelOpen = false; caravanTradeMade = false; caravanTimeout = null; // 2dk sonra tekrar gelsin (güncel stok ile) caravanNextArrivalTick = LK.ticks + 2 * 60 * 60; // 2dk sonra tekrar gelsin caravanLeaveTick = 0; } } } // Kervan update'i ana game.update'e ekle var originalGameUpdate = game.update; game.update = function () { // Kervan yoksa ve zamanı geldiyse spawn et if (!caravanActive && LK.ticks > caravanNextArrivalTick) { spawnCaravan(); } // Kervan aktifse ve varmadıysa hareket ettir if (caravanActive && caravan && !caravanArrived) { var targetX = caravanArriveTargetX; var targetY = caravanArriveTargetY; if (typeof caravan.moveTowards === "function") { caravan.moveTowards(targetX, targetY); } checkCaravanArrived(); caravan.visible = true; } // Kervan varınca sabit dursun if (caravanActive && caravanArrived && caravan && !caravanPanelOpen) { caravan.visible = true; } // Kervan paneli açıksa satırları güncelle if (caravanPanelOpen) { updateCaravanPanelRows(); } // Kervan ayrılma/tekrar gelme mantığı handleCaravanTimeouts(); if (typeof originalGameUpdate === "function") originalGameUpdate(); }; // Kervan panelini dışarıdan erişim için global yap window.toggleCaravanPanel = toggleCaravanPanel; // Kervan ilk başta pasif, 10 saniye (600 tick) sonra gelsin caravanNextArrivalTick = LK.ticks + 600; caravanActive = false; caravanArrived = false; caravanPanelOpen = false; caravanTradeMade = false; caravanTimeout = null; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var baseMoveMultiplier = 0.5; // Everyone moves 50% slower by default function getMoveMultiplier(level) { // Each level increases speed by 2% (so multiplier increases) // Level 1: 0.5, Level 2: 0.5*1.02, Level 3: 0.5*1.04, etc. return baseMoveMultiplier * (1 + 0.02 * (level - 1)); } var backgroundImg = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 1, scaleY: 1 }); backgroundImg.alpha = 1; game.addChildAt(backgroundImg, 0); // Add as the bottom-most layer // --- KARARGAH IMAGE & PANEL --- // --- HANGAR (Sol Depo) --- // Hangar görseli (haritanın solunda, karargahın solunda) var hangarImg = LK.getAsset('depo', { anchorX: 0.5, anchorY: 0.5, x: 180, // Sol kenara yakın y: 2400 }); game.addChild(hangarImg); // Hangar label (görselin altında) var hangarLabel = new Text2('HANGAR', { size: 36, fill: "#fff" }); hangarLabel.anchor.set(0.5, 0); hangarLabel.x = hangarImg.x; hangarLabel.y = hangarImg.y + hangarImg.height / 2 + 10; game.addChild(hangarLabel); // Hangar panel arka planı (solda açılır) var hangarPanelBg = LK.getAsset('depoPanelBg', { anchorX: 0.0, anchorY: 0.5, x: 40, // Sol kenar y: 1366, scaleX: 1.1, scaleY: 1.1 }); hangarPanelBg.alpha = 0.97; hangarPanelBg.visible = false; game.addChild(hangarPanelBg); // Hangar panel başlığı var hangarPanelTitle = new Text2('HANGAR', { size: 38, fill: "#000", fontWeight: "bold" }); hangarPanelTitle.anchor.set(0.5, 0.5); hangarPanelTitle.x = hangarPanelBg.x + hangarPanelBg.width / 2; hangarPanelTitle.y = hangarPanelBg.y - hangarPanelBg.height / 2 + 60; hangarPanelTitle.visible = false; game.addChild(hangarPanelTitle); // Hangar panel içeriği var hangarPanelContent = new Text2('', { size: 32, fill: "#000" }); hangarPanelContent.anchor.set(0.5, 0); hangarPanelContent.x = hangarPanelBg.x + hangarPanelBg.width / 2; hangarPanelContent.y = hangarPanelBg.y - hangarPanelBg.height / 2 + 120; hangarPanelContent.visible = false; game.addChild(hangarPanelContent); // Hangar paneli kapat ikonu var hangarCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); hangarCloseIcon.anchor.set(0.5, 0.5); hangarCloseIcon.x = hangarPanelBg.x + hangarPanelBg.width - 30; hangarCloseIcon.y = hangarPanelBg.y - hangarPanelBg.height / 2 + 30; hangarCloseIcon.visible = false; game.addChild(hangarCloseIcon); hangarCloseIcon.down = function () { hangarImg.down(); }; // Hangar panelini güncelleyen fonksiyon function updateHangarPanelContent() { // Kervan stoğu + tüm fabrika stokları var lines = []; // Kervandan alınanlar if (typeof hangarStock !== "undefined" && hangarStock) { lines.push("Kervan Stoğu:"); lines.push(" Cevher: " + (hangarStock.ore || 0) + " Odun: " + (hangarStock.wood || 0) + " Yiyecek: " + (hangarStock.food || 0)); var prodCounts = []; if (typeof productTypes !== "undefined" && productTypes && typeof productTypes.length === "number") { for (var p = 0; p < productTypes.length; p++) { var count = hangarStock.product && hangarStock.product[p] ? hangarStock.product[p] : 0; prodCounts.push(productTypes[p].name + ": " + count); } } lines.push(" Ürünler:"); for (var row = 0; row < 4; row++) { var start = row * 3; var end = start + 3; if (start < prodCounts.length) { lines.push(" " + prodCounts.slice(start, end).join(" ")); } } lines.push(""); } // Tüm fabrika stokları var totalOre = 0, totalWood = 0, totalFood = 0; var totalProducts = []; for (var p = 0; p < productTypes.length; p++) totalProducts[p] = 0; for (var i = 0; i < factoryList.length; i++) { totalOre += factoryList[i].oreBuffer || 0; totalWood += factoryList[i].woodBuffer || 0; totalFood += factoryList[i].foodBuffer || 0; for (var p = 0; p < productTypes.length; p++) { totalProducts[p] += factoryList[i].productBuffer[p] || 0; } } lines.push("Fabrika + Eski Stoklar:"); lines.push(" Cevher: " + totalOre + " Odun: " + totalWood + " Yiyecek: " + totalFood); var prodCounts2 = []; for (var p = 0; p < productTypes.length; p++) { prodCounts2.push(productTypes[p].name + ": " + totalProducts[p]); } lines.push(" Ürünler:"); for (var row = 0; row < 4; row++) { var start = row * 3; var end = start + 3; if (start < prodCounts2.length) { lines.push(" " + prodCounts2.slice(start, end).join(" ")); } } lines.push(""); hangarPanelContent.setText(lines.join("\n")); } // Hangar resmine tıklanınca paneli aç/kapat hangarImg.down = function () { var newVisible = !hangarPanelBg.visible; hangarPanelBg.visible = newVisible; hangarPanelTitle.visible = newVisible; hangarPanelContent.visible = newVisible; hangarCloseIcon.visible = newVisible; if (newVisible) updateHangarPanelContent(); }; // --- HANGAR Stokları --- // Kervandan alınanlar ve fabrika stokları burada tutulacak var hangarStock = { ore: 0, wood: 0, food: 0, product: [] }; if (typeof productTypes !== "undefined" && productTypes && typeof productTypes.length === "number") { for (var p = 0; p < productTypes.length; p++) hangarStock.product[p] = 0; } // Karargah image (sola, Kampımız'ın soluna) var karargahImg = LK.getAsset('city', { anchorX: 0.5, anchorY: 0.5, x: 1024 - 430, // Kampımız'ın x'i 1024, 430px sola y: 2400 }); game.addChild(karargahImg); // Karargah label below the image var karargahLabel = new Text2('Karargah', { size: 36, fill: "#fff" }); karargahLabel.anchor.set(0.5, 0); karargahLabel.x = karargahImg.x; karargahLabel.y = karargahImg.y + karargahImg.height / 2 + 10; game.addChild(karargahLabel); // Karargah panel (hidden by default) var karargahPanelBg = LK.getAsset('karargahPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 300, // Sola açılması için x: 300 (ekranın solunda) y: 1366, scaleX: 1.1, scaleY: 1.1 }); karargahPanelBg.alpha = 0.97; karargahPanelBg.visible = false; game.addChild(karargahPanelBg); // --- Not: Savaşı kaybederseniz askerler ölür. --- Bilgi metni panelin en altına ekleniyor var karargahPanelNoteTxt = new Text2("Not: Savaşı kaybederseniz askerler ölür.", { size: 28, fill: 0xB71C1C }); karargahPanelNoteTxt.anchor.set(0.5, 1); karargahPanelNoteTxt.x = karargahPanelBg.x; karargahPanelNoteTxt.y = karargahPanelBg.y + karargahPanelBg.height / 2 - 18; karargahPanelNoteTxt.visible = false; game.addChild(karargahPanelNoteTxt); // Karargah paneli kapat ikonu var karargahCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); karargahCloseIcon.anchor.set(0.5, 0.5); karargahCloseIcon.x = karargahPanelBg.x + karargahPanelBg.width / 2 - 30; karargahCloseIcon.y = karargahPanelBg.y - karargahPanelBg.height / 2 + 30; karargahCloseIcon.visible = false; game.addChild(karargahCloseIcon); karargahCloseIcon.down = function () { karargahImg.down(); }; // --- Yeni: Canavar kalan spawn süresi texti (karargah paneli notunun hemen üstünde) --- var karargahPanelEnemyTimerTxt = new Text2("", { size: 30, fill: "#333" }); karargahPanelEnemyTimerTxt.anchor.set(0.5, 1); karargahPanelEnemyTimerTxt.x = karargahPanelBg.x; karargahPanelEnemyTimerTxt.y = karargahPanelNoteTxt.y - 32; // Notun hemen üstünde karargahPanelEnemyTimerTxt.visible = false; game.addChild(karargahPanelEnemyTimerTxt); // Karargah paneli başlık var karargahPanelTitle = new Text2('Karargah', { size: 38, fill: "#000", fontWeight: "bold" }); karargahPanelTitle.anchor.set(0.5, 0.5); karargahPanelTitle.x = karargahPanelBg.x; karargahPanelTitle.y = karargahPanelBg.y - karargahPanelBg.height / 2 + 60; karargahPanelTitle.visible = false; game.addChild(karargahPanelTitle); // Total power display next to Karargah title var karargahTotalPowerTxt = new Text2('', { size: 32, fill: "#333", fontWeight: "bold" }); karargahTotalPowerTxt.anchor.set(0, 0.5); karargahTotalPowerTxt.x = karargahPanelTitle.x + 80; // Right of the title karargahTotalPowerTxt.y = karargahPanelTitle.y; karargahTotalPowerTxt.visible = false; game.addChild(karargahTotalPowerTxt); // Asker türleri ve fiyatları var soldierTypes = [{ type: 'yaya', label: 'Yaya', cost: 200 }, { type: 'okcu', label: 'Okçu', cost: 400 }, { type: 'mizrakci', label: 'Mızrakçı', cost: 600 }, { type: 'zirhli', label: 'Zırhlı', cost: 800 }, { type: 'atli', label: 'Atlı', cost: 1000 }]; // Panelde asker sayıları ve satın alma butonları var karargahPanelRows = []; var karargahPanelRowY0 = karargahPanelBg.y - karargahPanelBg.height / 2 + 120; var karargahPanelRowDY = 90; for (var i = 0; i < soldierTypes.length; i++) { var y = karargahPanelRowY0 + i * karargahPanelRowDY; // Asker görseli var img = LK.getAsset('soldier_' + soldierTypes[i].type, { anchorX: 0, anchorY: 0.5, x: karargahPanelBg.x - karargahPanelBg.width / 2 + 40, y: y }); img.visible = false; game.addChild(img); // Asker adı var nameTxt = new Text2(soldierTypes[i].label, { size: 36, fill: "#000", fontWeight: "bold" }); nameTxt.anchor.set(0, 0.5); nameTxt.x = img.x + 90; nameTxt.y = y; nameTxt.visible = false; game.addChild(nameTxt); // Asker sayısı var countTxt = new Text2('0', { size: 36, fill: "#000" }); countTxt.anchor.set(0, 0.5); countTxt.x = nameTxt.x + 120; countTxt.y = y; countTxt.visible = false; game.addChild(countTxt); // --- YENİ: Canavarı yenme yüzdesi --- // winRateTxt artık countTxt'nin ALTINDA gösterilecek var winRateTxt = new Text2('Yenme: %0', { size: 28, fill: 0x1565C0 }); winRateTxt.anchor.set(0, 0.5); // X'i countTxt ile aynı hizaya getir winRateTxt.x = countTxt.x; // Y'si countTxt'nin hemen altında olacak şekilde ayarla (10px boşluk) winRateTxt.y = countTxt.y + countTxt.height / 2 + 10; winRateTxt.visible = false; game.addChild(winRateTxt); // --- YENİ: Saldır butonu --- var attackBtn = new Text2('Saldır', { size: 32, fill: 0xd32f2f, fontWeight: "bold" }); attackBtn.anchor.set(1, 0.5); attackBtn.x = karargahPanelBg.x + karargahPanelBg.width / 2 - 40; attackBtn.y = y + 35; // Satın alma butonunun altına attackBtn.visible = false; (function (idx) { attackBtn.down = function () { // Sadece asker varsa ve düşman varsa saldır var count = 0; for (var j = 0; j < soldierList.length; j++) { if (soldierList[j].soldierType === soldierTypes[idx].type && soldierList[j].state === 'idle') count++; } if (count > 0 && currentEnemy && !soldierList.some(function (s) { return s.soldierType === soldierTypes[idx].type && s.state === 'moving'; })) { // Sadece bu tipteki idle askerleri gönder for (var j = 0; j < soldierList.length; j++) { var s = soldierList[j]; if (s.soldierType === soldierTypes[idx].type && s.state === 'idle') { s.targetEnemy = currentEnemy; // Hedefe gitme süresi askerin hızına göre değişsin var tx = currentEnemy.x + Math.random() * 40 - 20; var ty = currentEnemy.y + Math.random() * 40 - 20; s.goTo(tx, ty); } } // --- Savaş efekti: canavarın üstünde bir resim ve animasyon --- // Savaş efekti resmi (örnek: pickaxe veya başka bir var olan asset) var battleEffect = LK.getAsset('pickaxe', { anchorX: 0.5, anchorY: 0.5, x: currentEnemy.x, y: currentEnemy.y - (currentEnemy.sprite ? currentEnemy.sprite.height / 2 : 60) - 30, scaleX: 1.5, scaleY: 1.5 }); game.addChild(battleEffect); // Basit animasyon: yukarı-aşağı sallama ve fade out tween(battleEffect, { y: battleEffect.y - 40, rotation: Math.PI / 6 }, { duration: 180, easing: tween.cubicInOut, onFinish: function onFinish() { tween(battleEffect, { y: battleEffect.y + 40, rotation: -Math.PI / 6, alpha: 0 }, { duration: 220, easing: tween.cubicInOut, onFinish: function onFinish() { if (battleEffect) battleEffect.destroy(); } }); } }); } }; })(i); game.addChild(attackBtn); // --- YENİ: Hepsini Gönder butonu --- var sendAllBtn = new Text2('Hepsini Gönder', { size: 28, fill: 0xff5722, fontWeight: "bold" }); sendAllBtn.anchor.set(1, 0.5); sendAllBtn.x = karargahPanelBg.x + karargahPanelBg.width / 2 - 40; sendAllBtn.y = y + 70; // Attack butonunun altına sendAllBtn.visible = false; (function (idx) { sendAllBtn.down = function () { // Tüm idle askerleri gönder var totalSent = 0; if (currentEnemy) { for (var j = 0; j < soldierList.length; j++) { var s = soldierList[j]; if (s.state === 'idle') { s.targetEnemy = currentEnemy; var tx = currentEnemy.x + Math.random() * 40 - 20; var ty = currentEnemy.y + Math.random() * 40 - 20; s.goTo(tx, ty); totalSent++; } } // Savaş efekti (tüm askerler gönderildiğinde daha büyük efekt) if (totalSent > 0) { var battleEffect = LK.getAsset('pickaxe', { anchorX: 0.5, anchorY: 0.5, x: currentEnemy.x, y: currentEnemy.y - (currentEnemy.sprite ? currentEnemy.sprite.height / 2 : 60) - 30, scaleX: 2.0, scaleY: 2.0 }); game.addChild(battleEffect); tween(battleEffect, { y: battleEffect.y - 50, rotation: Math.PI / 4 }, { duration: 200, easing: tween.cubicInOut, onFinish: function onFinish() { tween(battleEffect, { y: battleEffect.y + 50, rotation: -Math.PI / 4, alpha: 0 }, { duration: 250, easing: tween.cubicInOut, onFinish: function onFinish() { if (battleEffect) battleEffect.destroy(); } }); } }); } } }; })(i); game.addChild(sendAllBtn); // Satın alma butonu var buyBtn = new Text2('Eğit (₺' + soldierTypes[i].cost + ')', { size: 36, fill: 0x2E7D32, fontWeight: "bold" }); buyBtn.anchor.set(1, 0.5); buyBtn.x = karargahPanelBg.x + karargahPanelBg.width / 2 - 40; buyBtn.y = y; buyBtn.visible = false; (function (idx) { // --- Dynamic soldier prices --- if (typeof soldierTypes[idx].dynamicCost === "undefined") { soldierTypes[idx].dynamicCost = soldierTypes[idx].cost; } buyBtn.setText('Eğit (₺' + soldierTypes[idx].dynamicCost + ')'); buyBtn.down = function () { if (money >= soldierTypes[idx].dynamicCost) { money -= soldierTypes[idx].dynamicCost; soldierTypes[idx].dynamicCost = Math.ceil(soldierTypes[idx].dynamicCost * 1.1); buyBtn.setText('Eğit (₺' + soldierTypes[idx].dynamicCost + ')'); updateMoneyText(); // Yeni asker oluştur var s = new Soldier(); s.setType(soldierTypes[idx].type); s.x = karargahImg.x + 80 + Math.random() * 40 - 20; s.y = karargahImg.y + 80 + Math.random() * 40 - 20; soldierList.push(s); game.addChild(s); updateKarargahPanelRows(); } }; })(i); game.addChild(buyBtn); karargahPanelRows.push({ img: img, nameTxt: nameTxt, countTxt: countTxt, buyBtn: buyBtn, winRateTxt: winRateTxt, attackBtn: attackBtn, sendAllBtn: sendAllBtn }); } // Paneli güncelleyen fonksiyon function updateKarargahPanelRows() { // Calculate total army power var totalArmyPower = 0; for (var j = 0; j < soldierList.length; j++) { totalArmyPower += soldierList[j].attack + soldierList[j].defense; } // Calculate power multiplier based on total army power var powerMultiplier = Math.max(1, Math.round(totalArmyPower / 18 * 10) / 10); // Base power is 18 (yaya), round to 1 decimal karargahTotalPowerTxt.setText("Toplam Güç " + powerMultiplier + "x"); karargahTotalPowerTxt.visible = karargahPanelBg.visible; for (var i = 0; i < soldierTypes.length; i++) { var count = 0; for (var j = 0; j < soldierList.length; j++) { if (soldierList[j].soldierType === soldierTypes[i].type) count++; } karargahPanelRows[i].countTxt.setText(count + " adet"); // Buton pasif/gri yap karargahPanelRows[i].buyBtn.alpha = money >= soldierTypes[i].cost ? 1 : 0.4; // --- YENİ: Canavarı yenme yüzdesi ve saldır butonu güncelle --- var winRate = 0; var canAttack = false; if (typeof currentEnemy !== "undefined" && currentEnemy) { // Bu tipteki askerlerin toplam saldırı ve savunması var totalAttack = 0, totalDefense = 0, soldierCount = 0; for (var j = 0; j < soldierList.length; j++) { if (soldierList[j].soldierType === soldierTypes[i].type) { totalAttack += soldierList[j].attack; totalDefense += soldierList[j].defense; soldierCount++; } } // Basit bir oran: (asker saldırı + savunma) / (düşman saldırı + savunma) * 100 // Savaşı kazanmak %50 oranında zorlaşsın: winRate'i yarıya düşür var enemyPower = currentEnemy.attack + currentEnemy.defense; var ourPower = totalAttack + totalDefense; if (enemyPower > 0) { winRate = Math.min(100, Math.round(ourPower / enemyPower * 100 * 0.5)); } // Saldır butonu sadece asker varsa ve düşman varsa aktif canAttack = soldierCount > 0; } karargahPanelRows[i].winRateTxt.setText("Yenme: %" + winRate); karargahPanelRows[i].winRateTxt.visible = karargahPanelBg.visible; karargahPanelRows[i].attackBtn.visible = karargahPanelBg.visible; karargahPanelRows[i].attackBtn.alpha = canAttack ? 1 : 0.4; karargahPanelRows[i].sendAllBtn.visible = karargahPanelBg.visible; // sendAllBtn only shows for the last row and only if there are any idle soldiers var hasAnyIdleSoldiers = soldierList.some(function (s) { return s.state === 'idle'; }); if (i === soldierTypes.length - 1) { karargahPanelRows[i].sendAllBtn.visible = karargahPanelBg.visible; karargahPanelRows[i].sendAllBtn.alpha = hasAnyIdleSoldiers && currentEnemy ? 1 : 0.4; } else { karargahPanelRows[i].sendAllBtn.visible = false; } } // --- Not: Savaşı kaybederseniz askerler ölür. --- Bilgi metni panelin en altına ekleniyor if (typeof karargahPanelNoteTxt !== "undefined") { karargahPanelNoteTxt.visible = karargahPanelBg.visible; } } // Show/hide Karargah panel on image press karargahImg.down = function () { var newVisible = !karargahPanelBg.visible; karargahPanelBg.visible = newVisible; karargahPanelTitle.visible = newVisible; karargahTotalPowerTxt.visible = newVisible; karargahCloseIcon.visible = newVisible; for (var i = 0; i < karargahPanelRows.length; i++) { karargahPanelRows[i].img.visible = newVisible; karargahPanelRows[i].nameTxt.visible = newVisible; karargahPanelRows[i].countTxt.visible = newVisible; karargahPanelRows[i].buyBtn.visible = newVisible; // Hide winRateTxt and attackBtn when panel is closed karargahPanelRows[i].winRateTxt.visible = newVisible; karargahPanelRows[i].attackBtn.visible = newVisible; } // Show/hide the note at the bottom of the panel if (typeof karargahPanelNoteTxt !== "undefined") { karargahPanelNoteTxt.visible = newVisible; } // Yeni: spawn süresi textini göster/gizle if (typeof karargahPanelEnemyTimerTxt !== "undefined") { karargahPanelEnemyTimerTxt.visible = newVisible; } // Show/hide sendAllBtn for each row for (var i = 0; i < karargahPanelRows.length; i++) { if (karargahPanelRows[i].sendAllBtn) { karargahPanelRows[i].sendAllBtn.visible = newVisible && i === soldierTypes.length - 1; } } if (newVisible) updateKarargahPanelRows(); }; // City colored image asset (example: blue city icon) // Global game state var minerList = []; var oduncuList = []; var mineList = []; var factoryList = []; var shopList = []; var carrierList = []; var researcherList = []; var customerList = []; var treeList = []; var foodList = []; var toplayiciList = []; var money = 50; var city = null; function spawnCustomer() { if (shopList.length === 0) return; var customer = new Customer(); customer.x = city.x; customer.y = city.y + 40; customer.targetShop = shopList[0]; customerList.push(customer); game.addChild(customer); // Kervan sadece şehirden bilgi alınca gelsin: ilk müşteri spawn edildiğinde kervan çağır if (!caravanActive && LK.ticks >= caravanNextArrivalTick) { spawnCaravan(); } } function spawnTree() { var tree = new Tree(); // Place at random location across the game area, avoiding bottom area where buildings are tree.x = 200 + Math.random() * 1600; tree.y = 400 + Math.random() * 1400; treeList.push(tree); game.addChild(tree); } function spawnFood() { var food = new Food(); // Place at random location across the game area, avoiding bottom area where buildings are food.x = 200 + Math.random() * 1600; food.y = 400 + Math.random() * 1400; foodList.push(food); game.addChild(food); } function spawnResearcher() { var researcher = new Researcher(); // Place at random near bottom researcher.x = 200 + Math.random() * 1600; researcher.y = 2300 + Math.random() * 200; researcherList.push(researcher); game.addChild(researcher); } function spawnOduncu() { var oduncu = new Oduncu(); // Place at random near bottom oduncu.x = 400 + Math.random() * 1200; oduncu.y = 2300 + Math.random() * 200; oduncuList.push(oduncu); game.addChild(oduncu); } function spawnToplayici() { var toplayici = new Toplayici(); // Place at random near bottom toplayici.x = 400 + Math.random() * 1200; toplayici.y = 2300 + Math.random() * 200; toplayiciList.push(toplayici); game.addChild(toplayici); } function spawnCarrier() { var carrier = new Carrier(); // Place at random near bottom carrier.x = 600 + Math.random() * 800; carrier.y = 2300 + Math.random() * 200; carrierList.push(carrier); game.addChild(carrier); } // UI var moneyText = new Text2('₺' + money, { size: 36, fill: 0xFFE066 }); moneyText.anchor.set(0.5, 0); LK.gui.top.addChild(moneyText); // Nasıl Oynanır? button below money text var howToPlayBtn = new Text2('Nasıl Oynanır?', { size: 28, fill: 0xFFFFFF, fontWeight: "bold" }); howToPlayBtn.anchor.set(0.5, 0); howToPlayBtn.x = moneyText.x; howToPlayBtn.y = moneyText.y + 50; // 50px below money text LK.gui.top.addChild(howToPlayBtn); // Kervan kalan spawn süresi texti (Nasıl Oynanır? yazısının altına) var caravanSpawnTimerTxt = new Text2("", { size: 24, fill: "#fff" }); caravanSpawnTimerTxt.anchor.set(0.5, 0); caravanSpawnTimerTxt.x = howToPlayBtn.x; caravanSpawnTimerTxt.y = howToPlayBtn.y + 40; // 40px below Nasıl Oynanır? butonu LK.gui.top.addChild(caravanSpawnTimerTxt); function updateMoneyText() { moneyText.setText('₺' + money); } // --- NASIL OYNANIR PANELİ --- var howToPlayPanelBg = LK.getAsset('businessPanelBg', { anchorX: 1.0, anchorY: 0.0, x: 2048 - 40, y: 40, scaleX: 1.2, scaleY: 1.2 }); howToPlayPanelBg.alpha = 0.97; howToPlayPanelBg.visible = false; game.addChild(howToPlayPanelBg); // Panel başlığı var howToPlayTitle = new Text2('Nasıl Oynanır?', { size: 42, fill: "#000", fontWeight: "bold" }); howToPlayTitle.anchor.set(0.5, 0.5); howToPlayTitle.x = howToPlayPanelBg.x - howToPlayPanelBg.width / 2; howToPlayTitle.y = howToPlayPanelBg.y + 60; howToPlayTitle.visible = false; game.addChild(howToPlayTitle); // Oyun açıklaması var howToPlayText = new Text2('OYUNUN AMACI:\n' + '• Para kazanarak işletmenizi büyütün\n' + '• Madenciler cevher, oduncular odun, toplayıcılar yiyecek toplar\n' + '• Fabrikalar bu hammaddeleri ürüne çevirir\n' + '• Taşıyıcılar ürünleri mağazaya götürür\n' + '• Müşteriler ürün satın alır, para kazanırsınız\n\n' + 'SAVAŞ SİSTEMİ:\n' + '• Düzenli olarak canavarlar saldırır\n' + '• Karargahtan asker eğitip canavarlarla savaşın\n' + '• Savaşı kaybederseniz askerleriniz ölür\n\n' + 'İŞLETMELER:\n' + '• İşletmeler satış gelirlerinizi artırır\n' + '• Her seviye %2 hız artışı sağlar\n\n' + 'İPUCU:\n' + '• Araştırmacılar tükenen madenleri yeniler\n' + '• Sağ aşağıda bulunan DEPO sayfasını kontrol ederek,\n ihtiyacınız olan çalışanı işe alın.', { size: 28, fill: "#000" }); howToPlayText.anchor.set(0.5, 0); howToPlayText.x = howToPlayPanelBg.x - howToPlayPanelBg.width / 2; howToPlayText.y = howToPlayPanelBg.y + 120; howToPlayText.visible = false; game.addChild(howToPlayText); // Kapat ikonu var howToPlayCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); howToPlayCloseIcon.anchor.set(0.5, 0.5); howToPlayCloseIcon.x = howToPlayPanelBg.x - 30; howToPlayCloseIcon.y = howToPlayPanelBg.y + 30; howToPlayCloseIcon.visible = false; game.addChild(howToPlayCloseIcon); // Panel toggle function function toggleHowToPlayPanel() { var newVisible = !howToPlayPanelBg.visible; howToPlayPanelBg.visible = newVisible; howToPlayTitle.visible = newVisible; howToPlayText.visible = newVisible; howToPlayCloseIcon.visible = newVisible; } // Button click events howToPlayBtn.down = function () { toggleHowToPlayPanel(); }; howToPlayCloseIcon.down = function () { toggleHowToPlayPanel(); }; // Add buttons for buying miners and mines // Satın alma butonları ve yazıları gizlendi (Madenci Al, Maden Aç, Fabrika Kur, Taşıyıcı Al) // (Butonlar ve ilgili eventler kaldırıldı) // Spawning functions function spawnMiner() { var miner = new Miner(); // Place at random near bottom miner.x = 400 + Math.random() * 1200; miner.y = 2300 + Math.random() * 200; minerList.push(miner); game.addChild(miner); } function spawnMine() { var mine = new Mine(); // Place at random in upper half mine.x = 300 + Math.random() * 1400; mine.y = 600 + Math.random() * 600; mineList.push(mine); game.addChild(mine); } function spawnFactory() { var factory = new Factory(); // Place at center factory.x = 1024; factory.y = 1600; factoryList.push(factory); game.addChild(factory); } function spawnShop() { var shop = new Shop(); shop.x = 1024; shop.y = 350; shopList.push(shop); game.addChild(shop); } // Initial setup // Add worker start position image at bottom center var workerStartImg = LK.getAsset('workerStart', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2400 }); game.addChild(workerStartImg); // Başlangıç yerindeki resme tıklanınca business paneli aç/kapat workerStartImg.down = function () { businessPanel.toggle(); }; // Add 'Kampımız' label below the starting area image var kampimizLabel = new Text2('Kampımız', { size: 36, fill: "#fff" }); kampimizLabel.anchor.set(0.5, 0); kampimizLabel.x = workerStartImg.x; kampimizLabel.y = workerStartImg.y + workerStartImg.height / 2 + 10; game.addChild(kampimizLabel); // Kampımız labelına tıklanınca işletmeler panelini aç/kapat kampimizLabel.down = function () { businessPanel.toggle(); }; // --- BUSINESS PANEL INSTANCE --- var businessPanel = new BusinessPanel(); game.addChild(businessPanel); // Add Araştırma Kampı image (was restAreaImg) var researchCampImg = LK.getAsset('restAreaSide', { anchorX: 0.5, anchorY: 0.5, x: 1024 + 430, y: 2400 }); game.addChild(researchCampImg); // Add a new image to the right of the research camp var researchCampRightImg = LK.getAsset('workerPanel', { anchorX: 0.0, anchorY: 0.5, x: researchCampImg.x + 180, // 180px right of center of research camp y: researchCampImg.y }); game.addChild(researchCampRightImg); // Add a new depoWorker image above the workerPanel image var workerPanelTopImg = LK.getAsset('depoWorker', { anchorX: 0.5, anchorY: 1.0, x: researchCampRightImg.x + researchCampRightImg.width / 2, y: researchCampRightImg.y - researchCampRightImg.height / 2 - 10 }); game.addChild(workerPanelTopImg); // Add 'Depo' label above the workerPanelTopImg image var depoLabel = new Text2('Depo', { size: 36, fill: "#fff" }); depoLabel.anchor.set(0.5, 1); depoLabel.x = workerPanelTopImg.x; depoLabel.y = workerPanelTopImg.y - workerPanelTopImg.height / 2 - 10; game.addChild(depoLabel); // --- DEPO PANEL --- // Panel arka planı (Depo paneli) var depoPanelBg = LK.getAsset('depoPanelBg', { anchorX: 1.0, anchorY: 0.0, x: 2048 - 40, // sağ üstte, 40px içeride y: 40, // üstten 40px aşağıda scaleX: 1.1, scaleY: 1.1 }); depoPanelBg.alpha = 0.97; depoPanelBg.visible = false; game.addChild(depoPanelBg); // Depo görseli (artık shop yerine depo resmi kullanılıyor) var depoImage = LK.getAsset('depo', { anchorX: 0.5, anchorY: 1.0, x: depoPanelBg.x - depoPanelBg.width / 2, y: depoPanelBg.y - 10, // panelin üstüne hizala scaleX: 0.8, scaleY: 0.8 }); depoImage.visible = false; game.addChild(depoImage); // Panel başlığı var depoPanelTitle = new Text2('Depo', { size: 38, fill: "#000", fontWeight: "bold" }); depoPanelTitle.anchor.set(0.5, 0.5); depoPanelTitle.x = depoPanelBg.x - depoPanelBg.width / 2; depoPanelTitle.y = depoPanelBg.y + 60; depoPanelTitle.visible = false; game.addChild(depoPanelTitle); // Panel içeriği (örnek: fabrika ve mağaza ürünleri) var depoPanelContent = new Text2('', { size: 36, fill: "#000" }); depoPanelContent.anchor.set(0.5, 0); depoPanelContent.x = depoPanelBg.x - depoPanelBg.width / 2 - 30; depoPanelContent.y = depoPanelBg.y + 120; depoPanelContent.visible = false; game.addChild(depoPanelContent); // Depo paneli kapat ikonu var depoCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); depoCloseIcon.anchor.set(0.5, 0.5); depoCloseIcon.x = depoPanelBg.x - 30; depoCloseIcon.y = depoPanelBg.y + 30; depoCloseIcon.visible = false; game.addChild(depoCloseIcon); depoCloseIcon.down = function () { workerPanelTopImg.down(); }; // Depo paneli güncelleyen fonksiyon function updateDepoPanelContent() { // Fabrika ve mağaza ürünlerini 4 satırlık bloklar halinde alt alta göster var lines = []; // --- HANGAR: Toplu stokları da göster --- if (typeof hangarStock !== "undefined") { lines.push("HANGAR Toplu Stok:"); lines.push(" Cevher: " + (hangarStock.ore || 0) + " Odun: " + (hangarStock.wood || 0) + " Yiyecek: " + (hangarStock.food || 0)); var prodCounts = []; if (typeof productTypes !== "undefined" && productTypes && typeof productTypes.length === "number") { for (var p = 0; p < productTypes.length; p++) { prodCounts.push(productTypes[p].name + ": " + (hangarStock.product && hangarStock.product[p] ? hangarStock.product[p] : 0)); } } lines.push(" Ürünler:"); for (var row = 0; row < 4; row++) { var start = row * 3; var end = start + 3; if (start < prodCounts.length) { lines.push(" " + prodCounts.slice(start, end).join(" ")); } } lines.push(""); } for (var i = 0; i < factoryList.length; i++) { var factory = factoryList[i]; // Hammadde bilgileri ekle lines.push("Fabrika #" + (i + 1) + " Hammaddeler:"); lines.push(" Cevher: " + factory.oreBuffer + " Odun: " + factory.woodBuffer + " Yiyecek: " + factory.foodBuffer); lines.push(""); var prodCounts = []; for (var p = 0; p < productTypes.length; p++) { var count = factory.productBuffer[p] || 0; prodCounts.push(productTypes[p].name + ": " + count); } // 4 satırlık bloklar halinde alt alta yaz lines.push("Fabrika #" + (i + 1) + " Ürünler:"); for (var row = 0; row < 4; row++) { var start = row * 3; var end = start + 3; if (start < prodCounts.length) { lines.push(" " + prodCounts.slice(start, end).join(" ")); } } lines.push(""); } for (var i = 0; i < shopList.length; i++) { var shop = shopList[i]; var prodCounts = []; for (var p = 0; p < productTypes.length; p++) { var count = shop.productBuffer[p] || 0; prodCounts.push(productTypes[p].name + ": " + count); } lines.push("Mağaza #" + (i + 1) + ":"); for (var row = 0; row < 4; row++) { var start = row * 3; var end = start + 3; if (start < prodCounts.length) { lines.push(" " + prodCounts.slice(start, end).join(" ")); } } } depoPanelContent.setText(lines.join("\n")); } // Depo resmine tıklanınca paneli aç/kapat workerPanelTopImg.down = function () { var newVisible = !depoPanelBg.visible; depoPanelBg.visible = newVisible; depoPanelTitle.visible = newVisible; depoPanelContent.visible = newVisible; depoImage.visible = newVisible; depoCloseIcon.visible = newVisible; if (newVisible) updateDepoPanelContent(); }; // Add 'Çalışanlar' label below the workerPanel image var workerPanelLabel = new Text2('Çalışanlar', { size: 36, fill: "#fff" }); workerPanelLabel.anchor.set(0.5, 0); workerPanelLabel.x = researchCampRightImg.x + researchCampRightImg.width / 2; workerPanelLabel.y = researchCampRightImg.y + researchCampRightImg.height / 2 + 10; game.addChild(workerPanelLabel); // --- ÇALIŞANLAR PANELİ --- // ÇALIŞANLAR PANELİ arka planı (sol ortada açılır) var workersPanelBg = LK.getAsset('levelPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 505, // 300 + 204.8 (10% of 2048) = 504.8, move panel 10% right // Sol ortada açmak için x'i sağa kaydır y: 1366, // Ekranın ortası (2048x2732 için) scaleX: 1.1, scaleY: 1.1 }); workersPanelBg.alpha = 0.97; workersPanelBg.visible = false; game.addChild(workersPanelBg); // Panel başlığı var workersPanelTitle = new Text2('Çalışanlar', { size: 38, fill: "#000", fontWeight: "bold" }); workersPanelTitle.anchor.set(0.5, 0.5); workersPanelTitle.x = workersPanelBg.x; workersPanelTitle.y = workersPanelBg.y - workersPanelBg.height / 2 + 60; game.addChild(workersPanelTitle); // Çalışan sayıları için yazılar var workerPanelFontSize = 36; var workerPanelLeft = workersPanelBg.x - workersPanelBg.width / 2 + 60; var workerPanelRight = workersPanelBg.x + workersPanelBg.width / 2 - 60; var workerPanelRowY0 = workersPanelBg.y - 30; var workerPanelRowDY = 90; var workerCountMinerText = new Text2('', { size: workerPanelFontSize, fill: "#000" }); workerCountMinerText.anchor.set(0, 0.5); workerCountMinerText.x = workerPanelLeft; workerCountMinerText.y = workerPanelRowY0; game.addChild(workerCountMinerText); var workerCountCarrierText = new Text2('', { size: workerPanelFontSize, fill: "#000" }); workerCountCarrierText.anchor.set(0, 0.5); workerCountCarrierText.x = workerPanelLeft; workerCountCarrierText.y = workerPanelRowY0 + workerPanelRowDY; game.addChild(workerCountCarrierText); var workerCountResearcherText = new Text2('', { size: workerPanelFontSize, fill: "#000" }); workerCountResearcherText.anchor.set(0, 0.5); workerCountResearcherText.x = workerPanelLeft; workerCountResearcherText.y = workerPanelRowY0 + 2 * workerPanelRowDY; game.addChild(workerCountResearcherText); var workerCountOduncuText = new Text2('', { size: workerPanelFontSize, fill: "#000" }); workerCountOduncuText.anchor.set(0, 0.5); workerCountOduncuText.x = workerPanelLeft; workerCountOduncuText.y = workerPanelRowY0 + 3 * workerPanelRowDY; game.addChild(workerCountOduncuText); var workerCountToplayiciText = new Text2('', { size: workerPanelFontSize, fill: "#000" }); workerCountToplayiciText.anchor.set(0, 0.5); workerCountToplayiciText.x = workerPanelLeft; workerCountToplayiciText.y = workerPanelRowY0 + 4 * workerPanelRowDY; game.addChild(workerCountToplayiciText); // Satın alma butonları ve fiyatlar (panelin sağında, sayılarla hizalı) var buyWorkerMinerBtn = new Text2('Madenci Al (₺100)', { size: workerPanelFontSize, fill: "#333" }); buyWorkerMinerBtn.anchor.set(1, 0.5); buyWorkerMinerBtn.x = workerPanelRight; buyWorkerMinerBtn.y = workerPanelRowY0; game.addChild(buyWorkerMinerBtn); // --- Dynamic worker prices --- var workerMinerPrice = 100; var workerCarrierPrice = 150; var workerResearcherPrice = 200; var workerOduncuPrice = 120; var workerToplayiciPrice = 110; buyWorkerMinerBtn.setText('Madenci Al (₺' + workerMinerPrice + ')'); buyWorkerMinerBtn.down = function () { if (money >= workerMinerPrice) { money -= workerMinerPrice; workerMinerPrice = Math.ceil(workerMinerPrice * 1.1); buyWorkerMinerBtn.setText('Madenci Al (₺' + workerMinerPrice + ')'); updateMoneyText(); spawnMiner(); updateWorkerCounts(); } }; var buyWorkerCarrierBtn = new Text2('Taşıyıcı Al (₺' + workerCarrierPrice + ')', { size: workerPanelFontSize, fill: "#333" }); buyWorkerCarrierBtn.anchor.set(1, 0.5); buyWorkerCarrierBtn.x = workerPanelRight; buyWorkerCarrierBtn.y = workerPanelRowY0 + workerPanelRowDY; game.addChild(buyWorkerCarrierBtn); buyWorkerCarrierBtn.down = function () { if (money >= workerCarrierPrice) { money -= workerCarrierPrice; workerCarrierPrice = Math.ceil(workerCarrierPrice * 1.1); buyWorkerCarrierBtn.setText('Taşıyıcı Al (₺' + workerCarrierPrice + ')'); updateMoneyText(); spawnCarrier(); updateWorkerCounts(); } }; var buyWorkerResearcherBtn = new Text2('Araştırmacı Al (₺' + workerResearcherPrice + ')', { size: workerPanelFontSize, fill: "#333" }); buyWorkerResearcherBtn.anchor.set(1, 0.5); buyWorkerResearcherBtn.x = workerPanelRight; buyWorkerResearcherBtn.y = workerPanelRowY0 + 2 * workerPanelRowDY; game.addChild(buyWorkerResearcherBtn); buyWorkerResearcherBtn.down = function () { if (money >= workerResearcherPrice) { money -= workerResearcherPrice; workerResearcherPrice = Math.ceil(workerResearcherPrice * 1.1); buyWorkerResearcherBtn.setText('Araştırmacı Al (₺' + workerResearcherPrice + ')'); updateMoneyText(); spawnResearcher(); updateWorkerCounts(); } }; var buyWorkerOduncuBtn = new Text2('Oduncu Al (₺' + workerOduncuPrice + ')', { size: workerPanelFontSize, fill: "#333" }); buyWorkerOduncuBtn.anchor.set(1, 0.5); buyWorkerOduncuBtn.x = workerPanelRight; buyWorkerOduncuBtn.y = workerPanelRowY0 + 3 * workerPanelRowDY; game.addChild(buyWorkerOduncuBtn); buyWorkerOduncuBtn.down = function () { if (money >= workerOduncuPrice) { money -= workerOduncuPrice; workerOduncuPrice = Math.ceil(workerOduncuPrice * 1.1); buyWorkerOduncuBtn.setText('Oduncu Al (₺' + workerOduncuPrice + ')'); updateMoneyText(); spawnOduncu(); updateWorkerCounts(); } }; var buyWorkerToplayiciBtn = new Text2('Toplayıcı Al (₺' + workerToplayiciPrice + ')', { size: workerPanelFontSize, fill: "#333" }); buyWorkerToplayiciBtn.anchor.set(1, 0.5); buyWorkerToplayiciBtn.x = workerPanelRight; buyWorkerToplayiciBtn.y = workerPanelRowY0 + 4 * workerPanelRowDY; game.addChild(buyWorkerToplayiciBtn); buyWorkerToplayiciBtn.down = function () { if (money >= workerToplayiciPrice) { money -= workerToplayiciPrice; workerToplayiciPrice = Math.ceil(workerToplayiciPrice * 1.1); buyWorkerToplayiciBtn.setText('Toplayıcı Al (₺' + workerToplayiciPrice + ')'); updateMoneyText(); spawnToplayici(); updateWorkerCounts(); } }; // ÇALIŞANLAR PANELİ başlık, buton ve sayıları başta gizle workersPanelTitle.visible = false; buyWorkerMinerBtn.visible = false; buyWorkerCarrierBtn.visible = false; buyWorkerResearcherBtn.visible = false; buyWorkerOduncuBtn.visible = false; workerCountMinerText.visible = false; workerCountCarrierText.visible = false; workerCountResearcherText.visible = false; workerCountOduncuText.visible = false; // Çalışanlar paneli kapat ikonu var workersCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); workersCloseIcon.anchor.set(0.5, 0.5); workersCloseIcon.x = workersPanelBg.x + workersPanelBg.width / 2 - 30; workersCloseIcon.y = workersPanelBg.y - workersPanelBg.height / 2 + 30; workersCloseIcon.visible = false; game.addChild(workersCloseIcon); workersCloseIcon.down = function () { researchCampRightImg.down(); }; // workerPanel image'a tıklanınca paneli aç/kapat researchCampRightImg.down = function () { var newVisible = !workersPanelTitle.visible; workersPanelBg.visible = newVisible; workersPanelTitle.visible = newVisible; buyWorkerMinerBtn.visible = newVisible; buyWorkerCarrierBtn.visible = newVisible; buyWorkerResearcherBtn.visible = newVisible; buyWorkerOduncuBtn.visible = newVisible; buyWorkerToplayiciBtn.visible = newVisible; workerCountMinerText.visible = newVisible; workerCountCarrierText.visible = newVisible; workerCountResearcherText.visible = newVisible; workerCountOduncuText.visible = newVisible; workerCountToplayiciText.visible = newVisible; workersCloseIcon.visible = newVisible; if (newVisible) updateWorkerCounts(); }; // Çalışan sayısını güncelleyen fonksiyon function updateWorkerCounts() { workerCountMinerText.setText("Madenci: " + minerList.length); workerCountCarrierText.setText("Taşıyıcı: " + carrierList.length); workerCountResearcherText.setText("Araştırmacı: " + researcherList.length); workerCountOduncuText.setText("Oduncu: " + oduncuList.length); workerCountToplayiciText.setText("Toplayıcı: " + toplayiciList.length); } // Add 'Araştırma Kampı' label below the image var researchCampLabel = new Text2('Araştırma Kampı', { size: 36, fill: "#fff" }); researchCampLabel.anchor.set(0.5, 0); researchCampLabel.x = researchCampImg.x; researchCampLabel.y = researchCampImg.y + 90; game.addChild(researchCampLabel); // Create a panel for Araştırma Kampı (hidden by default) var researchCampPanelBg = LK.getAsset('researchCampPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 300, // sol ortada açmak için x'i sola al y: 1366, // ekranın ortası (2048x2732 için) scaleX: 1.1, scaleY: 1.1 }); researchCampPanelBg.alpha = 0.97; researchCampPanelBg.visible = false; game.addChild(researchCampPanelBg); var researchCampPanelText = new Text2('Araştırma Kampı\nYeni madenler için araştırmacı gönder.', { size: 36, fill: "#fff" }); researchCampPanelText.anchor.set(0, 0.5); researchCampPanelText.x = researchCampPanelBg.x - researchCampPanelBg.width / 2 + 40; researchCampPanelText.y = researchCampPanelBg.y - researchCampPanelBg.height / 2 + 80; researchCampPanelText.visible = false; game.addChild(researchCampPanelText); // Araştırma kampı paneli kapat ikonu var researchCloseIcon = new Text2('✕', { size: 42, fill: 0xFF0000, fontWeight: "bold" }); researchCloseIcon.anchor.set(0.5, 0.5); researchCloseIcon.x = researchCampPanelBg.x + researchCampPanelBg.width / 2 - 30; researchCloseIcon.y = researchCampPanelBg.y - researchCampPanelBg.height / 2 + 30; researchCloseIcon.visible = false; game.addChild(researchCloseIcon); researchCloseIcon.down = function () { researchCampImg.down(); }; // Show/hide panel on image press researchCampImg.down = function () { var newVisible = !researchCampPanelBg.visible; researchCampPanelBg.visible = newVisible; researchCampPanelText.visible = newVisible; researchCloseIcon.visible = newVisible; }; spawnMine(); spawnMine(); spawnFactory(); spawnShop(); spawnMiner(); spawnCarrier(); spawnResearcher(); spawnResearcher(); // İkinci araştırmacı spawnOduncu(); spawnToplayici(); // --- Kervan oyun başladıktan 10 saniye (600 tick) sonra gelsin --- // Kervan ilk başta pasif, sadece 10 saniye sonra aktifleşecek caravanNextArrivalTick = LK.ticks + 600; // 10 saniye (600 tick) sonra ilk geliş // Kervan başta pasif caravanActive = false; caravanArrived = false; caravanPanelOpen = false; caravanTradeMade = false; caravanTimeout = null; // Spawn 3 trees at random locations spawnTree(); spawnTree(); spawnTree(); // Spawn 3 food items at random locations spawnFood(); spawnFood(); spawnFood(); city = new City(); game.addChild(city); // Shop sell timer REMOVED: Carriers now deliver products // Dragging mines/factories for placement (future feature, not implemented now) // Main game update game.update = function () { // Helper function to check if an object overlaps with any open panel function isElementInPanelArea(element) { if (!element || !element.x || !element.y) return false; var elementBounds = { left: element.x - (element.width || 100) / 2, right: element.x + (element.width || 100) / 2, top: element.y - (element.height || 100) / 2, bottom: element.y + (element.height || 100) / 2 }; // Check overlap with business panel - using exact panel background dimensions if (businessPanel.visible) { var businessBounds = { left: 1024 - 866.7 * 1.1 / 2, // exact business panel bg scaled width/2 right: 1024 + 866.7 * 1.1 / 2, top: 900 - 650 * 1.1 / 2, // exact business panel bg scaled height/2 bottom: 900 + 650 * 1.1 / 2 }; if (elementBounds.right > businessBounds.left && elementBounds.left < businessBounds.right && elementBounds.bottom > businessBounds.top && elementBounds.top < businessBounds.bottom) { return true; } } // Check overlap with karargah panel - using exact panel background dimensions if (karargahPanelBg.visible) { var karargahBounds = { left: 300 - 650 * 1.1 / 2, // exact karargah panel bg scaled width/2 right: 300 + 650 * 1.1 / 2, top: 1366 - 650 * 1.1 / 2, // exact karargah panel bg scaled height/2 bottom: 1366 + 650 * 1.1 / 2 }; if (elementBounds.right > karargahBounds.left && elementBounds.left < karargahBounds.right && elementBounds.bottom > karargahBounds.top && elementBounds.top < karargahBounds.bottom) { return true; } } // Check overlap with depo panel - using exact panel background dimensions if (depoPanelBg.visible) { var depoBounds = { left: 2048 - 40 - 650 * 1.1, // depo panel anchor 1.0, 0.0 positioning right: 2048 - 40, top: 40, bottom: 40 + 600 * 1.1 // exact depo panel bg scaled height }; if (elementBounds.right > depoBounds.left && elementBounds.left < depoBounds.right && elementBounds.bottom > depoBounds.top && elementBounds.top < depoBounds.bottom) { return true; } } // Check overlap with workers panel - using exact panel background dimensions if (workersPanelBg.visible) { var workersBounds = { left: 505 - 650 * 1.1 / 2, // exact workers panel bg scaled width/2 right: 505 + 650 * 1.1 / 2, top: 1366 - 700 * 1.1 / 2, // exact workers panel bg scaled height/2 bottom: 1366 + 700 * 1.1 / 2 }; if (elementBounds.right > workersBounds.left && elementBounds.left < workersBounds.right && elementBounds.bottom > workersBounds.top && elementBounds.top < workersBounds.bottom) { return true; } } // Check overlap with level/research camp panel - using exact panel background dimensions if (levelPanelBg.visible || researchCampPanelBg.visible) { var levelBounds = { left: 300 - 650 * 1.1 / 2, // exact level panel bg scaled width/2 (levelPanelBg uses karargahPanelBg asset) right: 300 + 650 * 1.1 / 2, top: 1366 - 700 * 1.1 / 2, // exact level panel bg scaled height/2 (levelPanelBg) bottom: 1366 + 700 * 1.1 / 2 }; if (elementBounds.right > levelBounds.left && elementBounds.left < levelBounds.right && elementBounds.bottom > levelBounds.top && elementBounds.top < levelBounds.bottom) { return true; } } // Check overlap with Nasıl Oynanır panel - using exact panel background dimensions if (howToPlayPanelBg.visible) { var howToPlayBounds = { left: 2048 - 40 - 866.7 * 1.2, // howToPlayPanelBg anchor 1.0, 0.0 positioning with scale 1.2 right: 2048 - 40, top: 40, bottom: 40 + 650 * 1.2 // exact how to play panel bg scaled height }; if (elementBounds.right > howToPlayBounds.left && elementBounds.left < howToPlayBounds.right && elementBounds.bottom > howToPlayBounds.top && elementBounds.top < howToPlayBounds.bottom) { return true; } } return false; } // Tüm paneller açıldığında sadece panel arka planı kadar ana ekran unsurlarını gizle, panel dışı alanlar görünür kalsın var anyPanelOpen = karargahPanelBg.visible || businessPanel.visible || depoPanelBg.visible || workersPanelBg.visible || levelPanelBg.visible || researchCampPanelBg.visible || hangarPanelBg.visible || caravanPanelBg && caravanPanelBg.visible; // Always show background backgroundImg.visible = true; // Helper: Sadece panel arka planı kadar alanı gizle, panel dışı unsurlar görünür kalsın function isElementInAnyPanelBgArea(element) { if (!element || typeof element.x !== "number" || typeof element.y !== "number") return false; var elementBounds = { left: element.x - (element.width || 100) / 2, right: element.x + (element.width || 100) / 2, top: element.y - (element.height || 100) / 2, bottom: element.y + (element.height || 100) / 2 }; // İşletmeler paneli if (businessPanel.visible && businessPanel.children && businessPanel.children.length > 0) { var bg = businessPanel.children[0]; if (bg && bg.visible) { var left = bg.x - bg.width / 2, right = bg.x + bg.width / 2, top = bg.y - bg.height / 2, bottom = bg.y + bg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } } // Karargah paneli if (karargahPanelBg.visible) { var left = karargahPanelBg.x - karargahPanelBg.width / 2, right = karargahPanelBg.x + karargahPanelBg.width / 2, top = karargahPanelBg.y - karargahPanelBg.height / 2, bottom = karargahPanelBg.y + karargahPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // Depo paneli if (depoPanelBg.visible) { var left = depoPanelBg.x - depoPanelBg.width, right = depoPanelBg.x, top = depoPanelBg.y, bottom = depoPanelBg.y + depoPanelBg.height; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // Çalışanlar paneli if (workersPanelBg.visible) { var left = workersPanelBg.x - workersPanelBg.width / 2, right = workersPanelBg.x + workersPanelBg.width / 2, top = workersPanelBg.y - workersPanelBg.height / 2, bottom = workersPanelBg.y + workersPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // Level paneli if (levelPanelBg.visible) { var left = levelPanelBg.x - levelPanelBg.width / 2, right = levelPanelBg.x + levelPanelBg.width / 2, top = levelPanelBg.y - levelPanelBg.height / 2, bottom = levelPanelBg.y + levelPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // Araştırma kampı paneli if (researchCampPanelBg.visible) { var left = researchCampPanelBg.x - researchCampPanelBg.width / 2, right = researchCampPanelBg.x + researchCampPanelBg.width / 2, top = researchCampPanelBg.y - researchCampPanelBg.height / 2, bottom = researchCampPanelBg.y + researchCampPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // Nasıl Oynanır paneli if (howToPlayPanelBg.visible) { var left = howToPlayPanelBg.x - howToPlayPanelBg.width, right = howToPlayPanelBg.x, top = howToPlayPanelBg.y, bottom = howToPlayPanelBg.y + howToPlayPanelBg.height; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // HANGAR paneli (depoPanelBg ile karışmasın) if (hangarPanelBg && hangarPanelBg.visible) { var left = hangarPanelBg.x, right = hangarPanelBg.x + hangarPanelBg.width, top = hangarPanelBg.y - hangarPanelBg.height / 2, bottom = hangarPanelBg.y + hangarPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } // KERVAN paneli if (caravanPanelBg && caravanPanelBg.visible) { var left = caravanPanelBg.x - caravanPanelBg.width / 2, right = caravanPanelBg.x + caravanPanelBg.width / 2, top = caravanPanelBg.y - caravanPanelBg.height / 2, bottom = caravanPanelBg.y + caravanPanelBg.height / 2; if (elementBounds.right > left && elementBounds.left < right && elementBounds.bottom > top && elementBounds.top < bottom) return true; } return false; } // Show/hide main building images and labels based on panel bg overlap karargahImg.visible = !isElementInAnyPanelBgArea(karargahImg); karargahLabel.visible = !isElementInAnyPanelBgArea(karargahLabel); workerStartImg.visible = !isElementInAnyPanelBgArea(workerStartImg); kampimizLabel.visible = !isElementInAnyPanelBgArea(kampimizLabel); researchCampImg.visible = !isElementInAnyPanelBgArea(researchCampImg); researchCampLabel.visible = !isElementInAnyPanelBgArea(researchCampLabel); researchCampRightImg.visible = !isElementInAnyPanelBgArea(researchCampRightImg); workerPanelLabel.visible = !isElementInAnyPanelBgArea(workerPanelLabel); workerPanelTopImg.visible = !isElementInAnyPanelBgArea(workerPanelTopImg); depoLabel.visible = !isElementInAnyPanelBgArea(depoLabel); // Show/hide city based on panel bg overlap if (city) city.visible = !isElementInAnyPanelBgArea(city); // Show/hide workers and game objects based on panel bg overlap for (var i = 0; i < minerList.length; i++) { minerList[i].visible = !isElementInAnyPanelBgArea(minerList[i]); } for (var i = 0; i < carrierList.length; i++) { carrierList[i].visible = !isElementInAnyPanelBgArea(carrierList[i]); } for (var i = 0; i < researcherList.length; i++) { researcherList[i].visible = !isElementInAnyPanelBgArea(researcherList[i]); } for (var i = 0; i < oduncuList.length; i++) { oduncuList[i].visible = !isElementInAnyPanelBgArea(oduncuList[i]); } for (var i = 0; i < toplayiciList.length; i++) { toplayiciList[i].visible = !isElementInAnyPanelBgArea(toplayiciList[i]); } for (var i = 0; i < customerList.length; i++) { customerList[i].visible = !isElementInAnyPanelBgArea(customerList[i]); } for (var i = 0; i < mineList.length; i++) { mineList[i].visible = !isElementInAnyPanelBgArea(mineList[i]); } for (var i = 0; i < factoryList.length; i++) { factoryList[i].visible = !isElementInAnyPanelBgArea(factoryList[i]); } for (var i = 0; i < shopList.length; i++) { shopList[i].visible = !isElementInAnyPanelBgArea(shopList[i]); } for (var i = 0; i < soldierList.length; i++) { soldierList[i].visible = !isElementInAnyPanelBgArea(soldierList[i]); } for (var i = 0; i < treeList.length; i++) { treeList[i].visible = !isElementInAnyPanelBgArea(treeList[i]); } for (var i = 0; i < foodList.length; i++) { foodList[i].visible = !isElementInAnyPanelBgArea(foodList[i]); } if (currentEnemy) { currentEnemy.visible = !isElementInAnyPanelBgArea(currentEnemy); } // Show/hide status texts based on panel bg overlap for (var i = 0; i < statusTexts.length; i++) { statusTexts[i].visible = !isElementInAnyPanelBgArea(statusTexts[i]); } // --- Yeni: Karargah paneli açıkken kalan canavar spawn süresini güncelle --- if (typeof karargahPanelEnemyTimerTxt !== "undefined" && karargahPanelEnemyTimerTxt.visible) { // Eğer bir canavar yoksa ve cooldown devam ediyorsa kalan süreyi göster if (!currentEnemy && lastEnemyDefeatedTime > 0 && LK.ticks - lastEnemyDefeatedTime < 18000) { var ticksLeft = 18000 - (LK.ticks - lastEnemyDefeatedTime); var secondsLeft = Math.ceil(ticksLeft / 60); var min = Math.floor(secondsLeft / 60); var sec = secondsLeft % 60; var timeStr = min + "dk " + (sec < 10 ? "0" : "") + sec + "sn"; karargahPanelEnemyTimerTxt.setText("Yeni canavar için kalan süre: " + timeStr); } else { karargahPanelEnemyTimerTxt.setText(""); } } // --- Kervan kalan spawn süresi textini güncelle --- if (typeof caravanSpawnTimerTxt !== "undefined") { if (!caravanActive && LK.ticks < caravanNextArrivalTick) { var ticksLeft = caravanNextArrivalTick - LK.ticks; var secondsLeft = Math.ceil(ticksLeft / 60); var min = Math.floor(secondsLeft / 60); var sec = secondsLeft % 60; var timeStr = min + "dk " + (sec < 10 ? "0" : "") + sec + "sn"; caravanSpawnTimerTxt.setText("Yeni kervan için kalan süre: " + timeStr); } else if (!caravanActive && LK.ticks >= caravanNextArrivalTick) { caravanSpawnTimerTxt.setText("Kervan yolda!"); } else if (caravanActive) { // Kervan geldiğinde, butonu ekle var caravanBtnText = "Kervan geldi!"; caravanSpawnTimerTxt.setText(caravanBtnText); } else { caravanSpawnTimerTxt.setText(""); } } if (city) city.update(); // Update all customers for (var i = 0; i < customerList.length; i++) { customerList[i].update(); } // Update all miners for (var i = 0; i < minerList.length; i++) { minerList[i].update(); } // Update all factories for (var i = 0; i < factoryList.length; i++) { factoryList[i].update(); } // Update all carriers for (var i = 0; i < carrierList.length; i++) { carrierList[i].update(); } // Update all researchers for (var i = 0; i < researcherList.length; i++) { researcherList[i].update(); } // Update all oduncu for (var i = 0; i < oduncuList.length; i++) { oduncuList[i].update(); } // Update all toplayıcı for (var i = 0; i < toplayiciList.length; i++) { toplayiciList[i].update(); } // Remove depleted trees when collected for (var i = treeList.length - 1; i >= 0; i--) { if (treeList[i].collected) { treeList[i].destroy(); treeList.splice(i, 1); } } // Remove depleted food when collected or when out of resources for (var i = foodList.length - 1; i >= 0; i--) { if (foodList[i].collected) { foodList[i].destroy(); foodList.splice(i, 1); } } // Remove depleted mines and assign researcher to find new mine for (var i = mineList.length - 1; i >= 0; i--) { if (mineList[i].ore <= 0) { // Count existing resources before spawning new ones var treeCount = treeList.length; var oreCount = 0; var foodCount = 0; for (var j = 0; j < mineList.length; j++) { if (j !== i) { // Don't count the current depleted mine if (mineList[j].resourceType === 'ore') oreCount++; if (mineList[j].resourceType === 'food') foodCount++; } } // CRITICAL FIX: Capture the depleted mine type BEFORE removing it var depletedType = mineList[i].resourceType; // Remove the depleted mine mineList[i].destroy(); mineList.splice(i, 1); // Find an idle researcher only if we haven't reached the maximum of 4 var assigned = false; var canSpawnNew = false; if (depletedType === 'ore' && oreCount < 4) canSpawnNew = true; if (depletedType === 'food' && foodCount < 4) canSpawnNew = true; if (depletedType === 'wood' && treeCount < 4) canSpawnNew = true; if (canSpawnNew) { for (var r = 0; r < researcherList.length; r++) { var researcher = researcherList[r]; if (researcher.state === 'idle') { // Pick a random location in upper half for new mine var tx = 300 + Math.random() * 1400; var ty = 600 + Math.random() * 600; researcher.startResearch(tx, ty); assigned = true; break; } } } } } // --- ENEMY & SOLDIER SYSTEM --- // Enemy spawn logic if (!currentEnemy) { // 5 dakika bekleme (5*60*60 = 18000 tick, 60fps) if (lastEnemyDefeatedTime > 0 && LK.ticks - lastEnemyDefeatedTime < 18000) { // Waiting for cooldown } else { // Spawn new enemy at random location var enemyType = 1 + Math.floor(Math.random() * 10); // Calculate total soldier power var totalAttack = 0, totalDefense = 0; for (var i = 0; i < soldierList.length; i++) { totalAttack += soldierList[i].attack; totalDefense += soldierList[i].defense; } var avgPower = (totalAttack + totalDefense) / Math.max(1, soldierList.length * 2); // Power scale: sometimes strong, sometimes weak var powerScale = 0.7 + Math.random() * 1.3; // 0.7-2.0 if (Math.random() < 0.5) powerScale = Math.max(0.5, avgPower / 20 * (0.7 + Math.random() * 0.6)); var enemy = new Enemy(); enemy.setType(enemyType, powerScale); // Spawn at random place in upper half enemy.x = 400 + Math.random() * 1200; enemy.y = 600 + Math.random() * 600; game.addChild(enemy); currentEnemy = enemy; // Askerleri savaşa gönder for (var i = 0; i < soldierList.length; i++) { if (soldierList[i].state === 'idle') { soldierList[i].targetEnemy = enemy; soldierList[i].goTo(enemy.x + Math.random() * 40 - 20, enemy.y + Math.random() * 40 - 20); } } } } // Update all soldiers for (var i = 0; i < soldierList.length; i++) { soldierList[i].update(); } // Enemy and soldier fight logic if (currentEnemy) { // Soldiers attack if close enough var anyFighting = false; for (var i = 0; i < soldierList.length; i++) { var s = soldierList[i]; if (s.state === 'moving' && s.targetEnemy === currentEnemy) { // Check if close enough to fight var dx = s.x - currentEnemy.x; var dy = s.y - currentEnemy.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < 60) { s.state = 'fighting'; } } if (s.state === 'fighting' && s.targetEnemy === currentEnemy) { anyFighting = true; // --- Savaş süresi %100 uzasın: Saldırıları yarı hızda uygula --- if (!s.fightTick) s.fightTick = 0; s.fightTick++; if (s.fightTick % 2 === 0) { // Sadece 2 tickte bir saldırı uygula (savaş süresi 2 katı) // Soldier attacks enemy var damage = Math.max(1, s.attack - currentEnemy.defense / 4 + Math.random() * 2); currentEnemy.hp -= damage; // Enemy attacks back (canavar saldırı gücü %100 artırıldı, yani 2x) var enemyDmg = Math.max(0, currentEnemy.attack * 2 - s.defense / 3 + Math.random() * 2); // Asker ölme şansı: toplu saldırıda birkaç asker ölsün if (Math.random() < 0.25) { // %25 ihtimalle asker ölür // Sadece savaşan askeri öldür s.destroy(); soldierList.splice(i, 1); i--; // Listeyi güncelledik, indexi azalt continue; } } // If enemy dead if (currentEnemy.hp <= 0) { // Reward var reward = Math.max(100, Math.min(1000, currentEnemy.reward)); money += reward; updateMoneyText(); // Remove enemy currentEnemy.destroy(); currentEnemy = null; lastEnemyDefeatedTime = LK.ticks; // Soldiers return to HQ for (var j = 0; j < soldierList.length; j++) { if (soldierList[j].state === 'fighting') { soldierList[j].targetEnemy = null; soldierList[j].returnToHQ(); } } break; } // --- Savaş kaybedilince askerler ölsün --- // If all soldiers are defeated (enemy still alive, but no fighting soldiers left) if (currentEnemy && // enemy exists !anyFighting && // no soldiers fighting soldierList.some(function (s) { return s.state === 'moving' || s.state === 'fighting'; }) // there were soldiers sent ) { // Remove all soldiers who were fighting or moving to fight this enemy for (var j = soldierList.length - 1; j >= 0; j--) { var s = soldierList[j]; if ((s.state === 'moving' || s.state === 'fighting') && s.targetEnemy === currentEnemy) { s.destroy(); soldierList.splice(j, 1); } } } } } // If no soldiers left fighting, enemy just waits if (!anyFighting && currentEnemy) { // If all soldiers dead or retreated, enemy could disappear after a while (not implemented) } } // Soldiers at HQ wait for next enemy for (var i = 0; i < soldierList.length; i++) { if (soldierList[i].state === 'idle' && !soldierList[i].targetEnemy) { // Place at HQ // Optionally, could move them to a waiting area } } }; // --- PRODUCT TYPES --- var productTypes = [{ name: "Ürün 1", price: 10 }, { name: "Ürün 2", price: 12 }, { name: "Ürün 3", price: 14 }, { name: "Ürün 4", price: 16 }, { name: "Ürün 5", price: 18 }, { name: "Ürün 6", price: 20 }, { name: "Ürün 7", price: 22 }, { name: "Ürün 8", price: 24 }, { name: "Ürün 9", price: 26 }, { name: "Ürün 10", price: 28 }]; // Show product/ore/factory status as text overlays var statusTexts = []; function updateStatusTexts() { // Remove old for (var i = 0; i < statusTexts.length; i++) { statusTexts[i].destroy(); } statusTexts = []; // Mines for (var i = 0; i < mineList.length; i++) { var resourceLabel = mineList[i].resourceType === 'wood' ? 'Odun: ' : mineList[i].resourceType === 'food' ? 'Yiyecek: ' : 'Cevher: '; var t = new Text2(resourceLabel + mineList[i].ore, { size: 36, fill: "#fff" }); t.anchor.set(0.5, 1); t.x = mineList[i].x; t.y = mineList[i].y - 80; game.addChild(t); statusTexts.push(t); } // Factories // (Ürün ve cevher yazıları gizlendi) // Shops // (Mağaza ürün yazıları gizlendi) } var statusTimer = LK.setInterval(updateStatusTexts, 400); // Prevent UI overlap with top left menu // (All UI is placed away from top left 100x100 px) // (Satın alma butonları kaldırıldığı için bu satırlar kaldırıldı) // --- LEVEL PANEL (BOTTOM LEFT) --- // --- LEVEL PANEL (BOTTOM LEFT) --- // Move level panel content into Araştırma Kampı panel var levelPanelBg = LK.getAsset('levelPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 300, // sol ortada açmak için x'i sola al y: 1366, // ekranın ortası (2048x2732 için) scaleX: 1.1, scaleY: 1.1 }); levelPanelBg.alpha = 0.97; levelPanelBg.visible = false; game.addChild(levelPanelBg); var levelPanelText = new Text2('', { size: 36, fill: "#000" }); levelPanelText.anchor.set(0.5, 0.5); levelPanelText.x = levelPanelBg.x; levelPanelText.y = levelPanelBg.y; levelPanelText.visible = false; game.addChild(levelPanelText); // --- UPGRADE BUTTONS AND COSTS --- var upgradeButtons = []; var upgradeCostTexts = []; var upgradeTypes = [{ label: "Şehir", key: "city", color: 0x4FC3F7, costBase: 100, costStep: 100 }, { label: "Fabrika", key: "factory", color: 0xFFD54F, costBase: 80, costStep: 80 }, { label: "Mağaza", key: "shop", color: 0x81C784, costBase: 80, costStep: 80 }, { label: "Madenci", key: "miner", color: 0xFF8A65, costBase: 60, costStep: 60 }, { label: "Taşıyıcı", key: "carrier", color: 0xBA68C8, costBase: 60, costStep: 60 }, { label: "Oduncu", key: "oduncu", color: 0x8BC34A, costBase: 60, costStep: 60 }, { label: "Toplayıcı", key: "toplayici", color: 0xE91E63, costBase: 60, costStep: 60 }]; // Layout constants for alignment var panelLeft = levelPanelBg.x - levelPanelBg.width / 2 + 40; var panelTop = levelPanelBg.y - levelPanelBg.height / 2 + 40; var rowHeight = 100; var btnSize = 70; // Panel content positioning var panelLeft = levelPanelBg.x - levelPanelBg.width / 2 + 40; var panelTop = levelPanelBg.y - levelPanelBg.height / 2 + 40; var rowHeight = 100; var btnSize = 70; var textSize = 60; var btnTextSize = 36; var costTextSize = 36; // Her satır için: seviye label + seviye değeri + maliyet + buton yanyana var levelLabels = []; var levelValues = []; // Hız artışı açıklama metni (Şehir label'ının üstünde) var speedInfoTxt = new Text2("Her seviye hızı %2 oranda artırır", { size: 32, fill: "#000", fontWeight: "bold" }); speedInfoTxt.anchor.set(0, 0.5); speedInfoTxt.x = panelLeft; speedInfoTxt.y = panelTop - rowHeight / 2 + textSize / 2 + 8; speedInfoTxt.visible = false; game.addChild(speedInfoTxt); for (var i = 0; i < upgradeTypes.length; i++) { // Seviye label var labelTxt = new Text2(upgradeTypes[i].label + ":", { size: 36, fill: "#000", fontWeight: "bold" }); labelTxt.anchor.set(0, 0.5); labelTxt.x = panelLeft; labelTxt.y = panelTop + i * rowHeight + textSize / 2 + 8; labelTxt.visible = false; game.addChild(labelTxt); levelLabels.push(labelTxt); // Seviye değeri var valueTxt = new Text2("", { size: 36, fill: "#000", fontWeight: "bold" }); valueTxt.anchor.set(0, 0.5); valueTxt.x = panelLeft + 180; valueTxt.y = panelTop + i * rowHeight + textSize / 2 + 8; valueTxt.visible = false; game.addChild(valueTxt); levelValues.push(valueTxt); // Cost text (hemen valueTxt'nin sağında, arada boşluk yok) var costTxt = new Text2("", { size: costTextSize, fill: "#000", fontWeight: "bold" }); costTxt.anchor.set(0, 0.5); // costTxt.x = valueTxt.x + valueTxt.width + 0; // width bilinmediği için güncelleLevelPanel'de ayarlanacak costTxt.y = panelTop + i * rowHeight + textSize / 2 + 8; costTxt.visible = false; game.addChild(costTxt); upgradeCostTexts.push(costTxt); // Upgrade button (costTxt'nin hemen sağında olacak, x'i updateLevelPanel'de ayarlanacak) var btn = new Text2("▲", { size: btnTextSize, fill: upgradeTypes[i].color, fontWeight: "bold" }); btn.anchor.set(0, 0.5); // btn.x = btnOffsetX; // x'i updateLevelPanel'de ayarlayacağız btn.y = panelTop + i * rowHeight + textSize / 2 + 8; btn.visible = false; game.addChild(btn); upgradeButtons.push(btn); } // --- LEVEL PANEL UPDATE --- function updateLevelPanel() { // Find max levels for each type var factoryLevel = 0; for (var i = 0; i < factoryList.length; i++) { if (factoryList[i].level > factoryLevel) factoryLevel = factoryList[i].level; } var shopLevel = 0; for (var i = 0; i < shopList.length; i++) { if (shopList[i].level > shopLevel) shopLevel = shopList[i].level; } var cityLevel = city && city.level ? city.level : 1; var minerLevel = 0; for (var i = 0; i < minerList.length; i++) { if (minerList[i].level > minerLevel) minerLevel = minerList[i].level; } var carrierLevel = 0; for (var i = 0; i < carrierList.length; i++) { if (carrierList[i].level > carrierLevel) carrierLevel = carrierList[i].level; } var oduncuLevel = 0; for (var i = 0; i < oduncuList.length; i++) { if (oduncuList[i].level > oduncuLevel) oduncuLevel = oduncuList[i].level; } var toplayiciLevel = 0; for (var i = 0; i < toplayiciList.length; i++) { if (toplayiciList[i].level > toplayiciLevel) toplayiciLevel = toplayiciList[i].level; } // Paneldeki eski toplu metni gizle levelPanelText.setText(""); // Her satır için seviyeleri güncelle var levels = [cityLevel, factoryLevel || 1, shopLevel || 1, minerLevel || 1, carrierLevel || 1, oduncuLevel || 1, toplayiciLevel || 1]; for (var i = 0; i < upgradeTypes.length; i++) { // Seviye değerini göster levelLabels[i].visible = levelPanelText.visible; levelValues[i].visible = levelPanelText.visible; levelValues[i].setText(levels[i]); // Maliyet ve butonları güncelle var cost = upgradeTypes[i].costBase + (levels[i] - 1) * upgradeTypes[i].costStep; upgradeCostTexts[i].setText("₺" + cost); upgradeCostTexts[i].visible = levelPanelText.visible; upgradeButtons[i].visible = levelPanelText.visible; // Cost text'i valueTxt'nin hemen sağında hizala (boşluk yok) upgradeCostTexts[i].x = levelValues[i].x + levelValues[i].width + 8; // Upgrade butonunu costTxt'nin hemen sağında hizala (boşluk yok) upgradeButtons[i].x = upgradeCostTexts[i].x + upgradeCostTexts[i].width + 8; // Gray out if not enough money if (money < cost) { upgradeButtons[i].alpha = 0.4; upgradeCostTexts[i].alpha = 0.4; } else { upgradeButtons[i].alpha = 1; upgradeCostTexts[i].alpha = 1; } } } var levelPanelTimer = LK.setInterval(updateLevelPanel, 400); // --- LEVEL UPGRADES (button per type) --- upgradeButtons[0].down = function () { // City var cost = 100 + ((city && city.level ? city.level : 1) - 1) * 100; if (city && money >= cost) { city.level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[1].down = function () { // Factory var factoryLevel = factoryList.length > 0 ? factoryList[0].level : 1; var cost = 80 + (factoryLevel - 1) * 80; if (factoryList.length > 0 && money >= cost) { factoryList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[2].down = function () { // Shop var shopLevel = shopList.length > 0 ? shopList[0].level : 1; var cost = 80 + (shopLevel - 1) * 80; if (shopList.length > 0 && money >= cost) { shopList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[3].down = function () { // Miner var minerLevel = minerList.length > 0 ? minerList[0].level : 1; var cost = 60 + (minerLevel - 1) * 60; if (minerList.length > 0 && money >= cost) { minerList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[4].down = function () { // Carrier var carrierLevel = carrierList.length > 0 ? carrierList[0].level : 1; var cost = 60 + (carrierLevel - 1) * 60; if (carrierList.length > 0 && money >= cost) { carrierList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[5].down = function () { // Oduncu var oduncuLevel = oduncuList.length > 0 ? oduncuList[0].level : 1; var cost = 60 + (oduncuLevel - 1) * 60; if (oduncuList.length > 0 && money >= cost) { oduncuList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; upgradeButtons[6].down = function () { // Toplayıcı var toplayiciLevel = toplayiciList.length > 0 ? toplayiciList[0].level : 1; var cost = 60 + (toplayiciLevel - 1) * 60; if (toplayiciList.length > 0 && money >= cost) { toplayiciList[0].level++; money -= cost; updateMoneyText(); updateLevelPanel(); } }; // Show/hide Araştırma Kampı panel and level panel content together researchCampImg.down = function () { var newVisible = !levelPanelBg.visible; levelPanelBg.visible = newVisible; levelPanelText.visible = newVisible; researchCampPanelBg.visible = newVisible; researchCampPanelText.visible = newVisible; researchCloseIcon.visible = newVisible; for (var i = 0; i < upgradeButtons.length; i++) { upgradeButtons[i].visible = newVisible; upgradeCostTexts[i].visible = newVisible; if (typeof levelLabels !== "undefined" && levelLabels[i]) levelLabels[i].visible = newVisible; if (typeof levelValues !== "undefined" && levelValues[i]) levelValues[i].visible = newVisible; } if (typeof speedInfoTxt !== "undefined") speedInfoTxt.visible = newVisible; }; // ÇALIŞANLAR PANELİ başlık, buton ve sayıları başta gizle workersPanelTitle.visible = false; buyWorkerMinerBtn.visible = false; buyWorkerCarrierBtn.visible = false; buyWorkerResearcherBtn.visible = false; buyWorkerOduncuBtn.visible = false; buyWorkerToplayiciBtn.visible = false; workerCountMinerText.visible = false; workerCountCarrierText.visible = false; workerCountResearcherText.visible = false; workerCountOduncuText.visible = false; workerCountToplayiciText.visible = false; // --- FABRIKA AÇ BUTONU --- var factoryOpenCost = 1000; // Başlangıç maliyeti 1000 lira // Fabrika resmi (şehir resminin altında) var fabrikaAcIcon = LK.getAsset('fabrikaAcIcon', { anchorX: 0.5, anchorY: 0.5, x: city.x, // Şehir ile aynı x konumunda y: city.y + 200, // Şehir resminin 200px altında (1 satır aşağı) scaleX: 0.5, scaleY: 0.5 }); game.addChild(fabrikaAcIcon); // Fabrika aç buton container'ı (resmin altında) var fabrikaAcContainer = new Container(); fabrikaAcContainer.x = fabrikaAcIcon.x; // Resim ile aynı x konumunda fabrikaAcContainer.y = fabrikaAcIcon.y + 200; // Resmin 200px altında (1 satır daha aşağı) game.addChild(fabrikaAcContainer); // Fabrika aç yazısı var fabrikaAcText = new Text2('Fabrika Aç', { size: 36, fill: "#fff", fontWeight: "bold" }); fabrikaAcText.anchor.set(0.5, 0.5); fabrikaAcText.x = 0; // Container'ın merkezinde fabrikaAcText.y = -15; // Biraz yukarıda fabrikaAcContainer.addChild(fabrikaAcText); // Fiyat yazısı var fabrikaAcPrice = new Text2('₺' + factoryOpenCost, { size: 30, fill: "#fff", fontWeight: "bold" }); fabrikaAcPrice.anchor.set(0.5, 0.5); fabrikaAcPrice.x = 0; // Container'ın merkezinde fabrikaAcPrice.y = 15; // Text'in altında fabrikaAcContainer.addChild(fabrikaAcPrice); // Container'a tıklama olayı ekle var fabrikaAcBtn = fabrikaAcContainer; // Eski referansı korumak için fabrikaAcContainer.down = function () { if (money >= factoryOpenCost) { money -= factoryOpenCost; updateMoneyText(); // Yeni fabrika oluştur var newFactory = new Factory(); // Haritanın rastgele bir yerine yerleştir (üst yarı) newFactory.x = 300 + Math.random() * 1400; newFactory.y = 600 + Math.random() * 800; factoryList.push(newFactory); game.addChild(newFactory); // Fabrika açma maliyetini 10 katına çıkar factoryOpenCost *= 10; fabrikaAcPrice.setText('₺' + factoryOpenCost); } }; // Buton rengini para durumuna göre güncelle var updateFactoryBtnColor = LK.setInterval(function () { if (money >= factoryOpenCost) { fabrikaAcText.fill = "#fff"; // Beyaz fabrikaAcPrice.fill = "#fff"; // Beyaz fabrikaAcContainer.alpha = 1; } else { fabrikaAcText.fill = "#fff"; // Beyaz fabrikaAcPrice.fill = "#fff"; // Beyaz fabrikaAcContainer.alpha = 0.6; } }, 100); ;
===================================================================
--- original.js
+++ change.js
@@ -1845,12 +1845,12 @@
/****
* Game Code
****/
-// Global lists for soldiers and enemy
-// Enemy assets (10 types)
-// Soldier assets
// Add a background image to the game
+// Soldier assets
+// Enemy assets (10 types)
+// Global lists for soldiers and enemy
var soldierList = [];
var currentEnemy = null;
var lastEnemyDefeatedTime = 0;
// --- KERVAN SİSTEMİ: GELİŞMİŞ TİCARET PANELİ ve LOJİSTİK ---
Kazma cevheri kazma hareketli resmi.. In-Game asset. 2d. High contrast. No shadows
Cevher. In-Game asset. 2d. High contrast. No shadows
Üstten olacak şekilde hafif ormanlık ve dağlık olacak şekilde çayır.. In-Game asset. 2d. High contrast. Gölgelikler olsun. Map tarzı bir harita.. In-Game asset. 2d. High contrast. No shadows
Madenci. In-Game asset. 2d. High contrast. No shadows
Savaşçı. In-Game asset. 2d. High contrast. No shadows
Kılıç kalkan ok yay gibi savaş malzemeleri taşıyan at arabası. In-Game asset. 2d. High contrast. No shadows
Demirci, Eski savaş malzemeleri üretiyor. In-Game asset. 2d. High contrast. No shadows
Okçu savaşçı. In-Game asset. 2d. High contrast. No shadows
Eski çağ savaş malzemesi dükkanı. In-Game asset. 2d. High contrast. No shadows
Cevher. In-Game asset. 2d. High contrast. No shadows
Cevher. In-Game asset. 2d. High contrast. No shadows
Savaşçı kampı. In-Game asset. 2d. High contrast. No shadows
Büyük savaşçı kampı uzaktan görünüm. In-Game asset. 2d. High contrast. No shadows
Siyah sayfa. In-Game asset. 2d. High contrast. No shadows
Madenci. In-Game asset. 2d. High contrast. No shadows
Demirci ve madencilerin olduğu uzaktan bakış bir kamp alanı oluştur.. In-Game asset. 2d. High contrast. No shadows
Eski kılıçlı silahlar ve cevherlerin vs. olduğu uzaktan bakış depo alanı.. In-Game asset. 2d. High contrast. No shadows
Canavar. In-Game asset. 2d. High contrast. No shadows
Düşman canavar. In-Game asset. 2d. High contrast. No shadows
Düşman farklı canavar. In-Game asset. 2d. High contrast. No shadows
Kılıçlar savaş iconu. In-Game asset. 2d. High contrast. No shadows
Canavar. In-Game asset. 2d. High contrast. No shadows
Atlı savaşçı asker. In-Game asset. 2d. High contrast. No shadows
Mızraklı piyade asker. In-Game asset. 2d. High contrast. No shadows
Okçu piyade savaşçı. In-Game asset. 2d. High contrast. No shadows
Yaya Piyade savaşçı. In-Game asset. 2d. High contrast. No shadows
Zırhlı Savaşçı. In-Game asset. 2d. High contrast. No shadows
Yetişen yiyecek. In-Game asset. 2d. High contrast. No shadows
Yetişen Yiyecek. In-Game asset. 2d. High contrast. No shadows
Dalında çilek. In-Game asset. 2d. High contrast. No shadows
Dalında Meyve. In-Game asset. 2d. High contrast. No shadows
Oduncu. In-Game asset. 2d. High contrast. No shadows
Oduncu. In-Game asset. 2d. High contrast. No shadows
Oduncu. In-Game asset. 2d. High contrast. No shadows
Ağaç. In-Game asset. 2d. High contrast. No shadows
Ağaç. In-Game asset. 2d. High contrast. No shadows
Toplayıcı. In-Game asset. 2d. High contrast. No shadows
Toplayıcı. In-Game asset. 2d. High contrast. No shadows
İnşaat eski çağ. In-Game asset. 2d. High contrast. No shadows
Eski çağ savaş karavan. In-Game asset. 2d. High contrast. No shadows
Kalkan. In-Game asset. 2d. High contrast. No shadows
Kalkanlı Savaş Arabası. In-Game asset. 2d. High contrast. No shadows
Koçbaşı. In-Game asset. 2d. High contrast. No shadows
Kılıç. In-Game asset. 2d. High contrast. No shadows
Mızrak. In-Game asset. 2d. High contrast. No shadows
Ok ve Yay birlikte eski çağ. In-Game asset. 2d. High contrast. No shadows
Büyük savaş baltası. In-Game asset. 2d. High contrast. No shadows
Savaş Zırhı. In-Game asset. 2d. High contrast. No shadows
Miğfer. In-Game asset. 2d. High contrast. No shadows
Maden arayıcı eski çağ. In-Game asset. 2d. High contrast. No shadows
Arkaplan müziği için kullanacağım müzik ile ilgili bir icon. In-Game asset. 2d. High contrast. No shadows