User prompt
Çalışanlar üzerinde bulunan depo resmine özel resim dosyası dosya oluştur
User prompt
Depo panelinin resmine bir resim dosyası oluştur
User prompt
Depo resminin dosyasını oluştur
User prompt
Depo'ya bir resim oluştur
User prompt
Başlangıç yerinde ki resime Kampımız ismini ekle.
User prompt
Bekleme yerindeki resime Kampımız ismini ekle.
User prompt
Depo paneli içerisindeki yazıları alt alta 4 satır olacak şekilde hizala.
User prompt
Please fix the bug: 'buyMinerBtn is not defined' in or related to this line: 'buyMinerBtn.x = 400;' Line Number: 1126
User prompt
Sağ üstte bulunan madenci al vb. satın alma buton veya yazılarını gizle.
User prompt
fabrika ve mağaza üzerinde ki ürün ve cevher yazılarını gizle.
User prompt
Müşteriler ürün çeşidine bakmaksızın satın alım yapsın.
User prompt
Fabrika üzerinde bulunan ürün ve cevher yazıları görünmesin.
User prompt
Ekranın sağ üstünde görünen çalışanların satın al yazılarını tamamen gizle. Ayrıca mağaza ve fabrika üzerinde görünen ürün yazılarını da tamamen gizle.
User prompt
Depo isminde bir panel oluştur ve bu paneli Depo isminde ki resime tıklayınca aç.
User prompt
Bu resime Depo ismini ver.
User prompt
Çalışanlar resminin üstüne bir resim oluştur.
User prompt
10 farklı ürün çeşidi ekle.
User prompt
Madenci 100 taşıyıcı 150 araştırmacı 200 fiyatlarında olsun.
User prompt
Paneli %10 sağa kaydır.
User prompt
Çalışanlar paneli ekranın sol ortasında açılsın. Bu panel içerisine toplam çalışanların sayısı da ayrı ayrı yazılsın.
User prompt
Çalışanlar paneli sayfanın sol ortasında açılsın. Arkaplanda olan herşey gizlensin.
User prompt
Bu oluşturduğumuz resime Çalışanlar ismi ekle.
User prompt
Bu panele arka plan resim oluştur.
User prompt
Bu resime tıklayınca bu oluşturduğumuz Çalışanlar paneli açılsın.
User prompt
Bu resim dosyasına Çalışanlar ismini eklediğin bir panel oluştur. Bu panelden Madenci, Taşıyıcı, Araştırmacı kişiler satın alınabilsin.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // 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++) { 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++) { 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; // Move city to upper left side, but not in the 0-100px menu area self.y = 150; // Top left, but not in the 0-100px menu area 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]--; money += productTypes[self.wantProductType].price; 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]--; money += productTypes[p].price; 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; }); // Factory: Converts ore 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 // 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 ore (was 60, now 2x slower) self.processCounter = 0; self.update = function () { if (self.oreBuffer > 0) { self.processCounter++; if (self.processCounter >= Math.max(10, self.processTime - (self.level - 1) * 10)) { self.oreBuffer--; // Pick a random product type to produce var prodType = Math.floor(Math.random() * 10); self.productBuffer[prodType]++; self.processCounter = 0; } } else { self.processCounter = 0; } }; return self; }); // Mine: Contains ore, can be depleted var Mine = Container.expand(function () { var self = Container.call(this); // Pick a random ore image for this mine var oreImages = ['ore1', 'ore2', 'ore3', 'ore4', 'ore5', 'ore6', 'ore7', 'ore8', 'ore9', 'ore10']; var oreImgId = oreImages[Math.floor(Math.random() * oreImages.length)]; var mineSprite = self.attachAsset(oreImgId, { anchorX: 0.5, anchorY: 0.5 }); self.ore = 10; // initial 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 = 'ore'; if (self.pickaxeIcon) { self.pickaxeIcon.destroy(); self.pickaxeIcon = null; } self.goToFactory(factoryList[0]); } 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 { self.setIdle(); } } } else if (self.state === 'idle') { // Find nearest mine with ore var bestMine = null; var bestDist = Infinity; for (var i = 0; i < mineList.length; i++) { var m = mineList[i]; if (m.ore > 0) { 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); } } }; 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 }; } } }; 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; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Add a background image to the game 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 // City colored image asset (example: blue city icon) // Global game state var minerList = []; var mineList = []; var factoryList = []; var shopList = []; var carrierList = []; var researcherList = []; var customerList = []; 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); } 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 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); function updateMoneyText() { moneyText.setText('₺' + money); } // 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); // 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); // 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('levelPanelBg', { anchorX: 0.5, anchorY: 0.5, x: 1024, // ekran ortası y: 900, // üstte, shop/factory arası 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, y: depoPanelBg.y - depoPanelBg.height / 2 - 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; depoPanelTitle.y = depoPanelBg.y - depoPanelBg.height / 2 + 60; depoPanelTitle.visible = false; game.addChild(depoPanelTitle); // Panel içeriği (örnek: fabrika ve mağaza ürünleri) var depoPanelContent = new Text2('', { size: 32, fill: "#000" }); depoPanelContent.anchor.set(0.5, 0); depoPanelContent.x = depoPanelBg.x; depoPanelContent.y = depoPanelBg.y - depoPanelBg.height / 2 + 120; depoPanelContent.visible = false; game.addChild(depoPanelContent); // Depo panelini güncelleyen fonksiyon function updateDepoPanelContent() { // Fabrika ve mağaza ürünlerini 4 satırlık bloklar halinde alt alta göster var lines = []; for (var i = 0; i < factoryList.length; i++) { var factory = factoryList[i]; 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) + ":"); 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(" ")); } } } 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; 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 workerCountMinerText = new Text2('', { size: 32, fill: "#000" }); workerCountMinerText.anchor.set(0, 0.5); workerCountMinerText.x = workersPanelBg.x - workersPanelBg.width / 2 + 40; workerCountMinerText.y = workersPanelBg.y - 30; game.addChild(workerCountMinerText); var workerCountCarrierText = new Text2('', { size: 32, fill: "#000" }); workerCountCarrierText.anchor.set(0, 0.5); workerCountCarrierText.x = workersPanelBg.x - workersPanelBg.width / 2 + 40; workerCountCarrierText.y = workersPanelBg.y + 50; game.addChild(workerCountCarrierText); var workerCountResearcherText = new Text2('', { size: 32, fill: "#000" }); workerCountResearcherText.anchor.set(0, 0.5); workerCountResearcherText.x = workersPanelBg.x - workersPanelBg.width / 2 + 40; workerCountResearcherText.y = workersPanelBg.y + 130; game.addChild(workerCountResearcherText); // Satın alma butonları ve fiyatlar (panelin solunda, sayılarla hizalı) var workerBtnY0 = workersPanelBg.y - 30; var workerBtnDY = 80; // Madenci satın al var buyWorkerMinerBtn = new Text2('Madenci Al (₺100)', { size: 32, fill: "#333" }); buyWorkerMinerBtn.anchor.set(1, 0.5); buyWorkerMinerBtn.x = workersPanelBg.x + workersPanelBg.width / 2 - 40; buyWorkerMinerBtn.y = workerBtnY0; game.addChild(buyWorkerMinerBtn); buyWorkerMinerBtn.down = function () { if (money >= 100) { money -= 100; updateMoneyText(); spawnMiner(); updateWorkerCounts(); } }; // Taşıyıcı satın al var buyWorkerCarrierBtn = new Text2('Taşıyıcı Al (₺150)', { size: 32, fill: "#333" }); buyWorkerCarrierBtn.anchor.set(1, 0.5); buyWorkerCarrierBtn.x = workersPanelBg.x + workersPanelBg.width / 2 - 40; buyWorkerCarrierBtn.y = workerBtnY0 + workerBtnDY; game.addChild(buyWorkerCarrierBtn); buyWorkerCarrierBtn.down = function () { if (money >= 150) { money -= 150; updateMoneyText(); spawnCarrier(); updateWorkerCounts(); } }; // Araştırmacı satın al var buyWorkerResearcherBtn = new Text2('Araştırmacı Al (₺200)', { size: 32, fill: "#333" }); buyWorkerResearcherBtn.anchor.set(1, 0.5); buyWorkerResearcherBtn.x = workersPanelBg.x + workersPanelBg.width / 2 - 40; buyWorkerResearcherBtn.y = workerBtnY0 + 2 * workerBtnDY; game.addChild(buyWorkerResearcherBtn); buyWorkerResearcherBtn.down = function () { if (money >= 200) { money -= 200; updateMoneyText(); spawnResearcher(); 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; workerCountMinerText.visible = false; workerCountCarrierText.visible = false; workerCountResearcherText.visible = false; // 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; workerCountMinerText.visible = newVisible; workerCountCarrierText.visible = newVisible; workerCountResearcherText.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); } // 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('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 }); 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.5, 0.5); researchCampPanelText.x = researchCampPanelBg.x; researchCampPanelText.y = researchCampPanelBg.y - researchCampPanelBg.height / 2 + 80; researchCampPanelText.visible = false; game.addChild(researchCampPanelText); // Show/hide panel on image press researchCampImg.down = function () { researchCampPanelBg.visible = !researchCampPanelBg.visible; researchCampPanelText.visible = researchCampPanelBg.visible; }; spawnMine(); spawnMine(); spawnFactory(); spawnShop(); spawnMiner(); spawnCarrier(); spawnResearcher(); 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 () { 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(); } // Remove depleted mines and assign researcher to find new mine for (var i = mineList.length - 1; i >= 0; i--) { if (mineList[i].ore <= 0) { // Find an idle researcher var assigned = false; 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; } } mineList[i].destroy(); mineList.splice(i, 1); } } }; // --- 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 t = new Text2('Cevher: ' + 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", // Siyah renk fontWeight: "bold" // Kalın yazı }); levelPanelText.anchor.set(0, 0); levelPanelText.x = levelPanelBg.x - levelPanelBg.width / 2 + 40; levelPanelText.y = levelPanelBg.y - levelPanelBg.height / 2 + 40; 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 }]; // 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; // Move all panel content 1 column (250px) to the right var panelLeft = levelPanelBg.x - levelPanelBg.width / 2 + 40 + 250; 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; } // 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]; 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(); } }; // 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; 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; }; // No background, no music, no sound, as per requirements // End of MVP code;
===================================================================
--- original.js
+++ change.js
@@ -699,10 +699,10 @@
// 180px right of center of research camp
y: researchCampImg.y
});
game.addChild(researchCampRightImg);
-// Add a new image above the workerPanel image
-var workerPanelTopImg = LK.getAsset('workerStart', {
+// 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
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