User prompt
Bir resim dosyası oluştur. Araştırma kampının sağına gelsin.
User prompt
Bu resime bir panel oluştur ve panelin içerisine çalışanlar panelinin herşeyini taşı.
User prompt
Bu panele Çalışanlar isminde bir resim oluştur. Araştırma kampının sağına gelsin.
User prompt
Çalışanların satın alınabildiği bir panel oluştur. Bu panele bir resim dosyası oluştur. Araştırma kampının sağına ekle.
User prompt
Ürün üretim hızı %50 yavaş olsun. Cevher çıkarma hızı %50 yavaş olsun.
User prompt
Mağazada ürün kalmadı ise, müşteri şehirden gelmesin, mağazaya gelen müşteri yeni ürün gelene kadar mağazada beklesin.
User prompt
Panel içerisine şehir yazısının üstüne, ''Her seviye hızı %2 oranda artırır'' yazısı ekle.
User prompt
Seviye yükseltme butonlarını seviye maliyetinin yanına taşı. Sonrasında bütün içeriği aynı anda 1 satır sağa taşı.
User prompt
panel içerisindeki seviye sayısı ile yükseltme maliyeti arasında ki boşluğu kaldır.
User prompt
Paneli sol ortada aç.
User prompt
Panel içerisindeki yazı renklerini siyah ve kalın yap. Ayrıca seviye maliyet butonları ve maliyetini, seviye bilgisi ile yan yana gelecek şekilde yeniden hizala.
User prompt
Bu panel ve içerisindeki herşey ekranın sol alt köşesinde açılsın. Ayrıca seviye yükseltimi ve seviye yükseltme butonlarını seviye açıklamasına oranla hizala.
User prompt
Araştırma kampı içerisindeki yazı fontunu ve seviye buton boyutunu 36 yap
User prompt
Araştırma kampı içerisindeki yazı rengini siyah yap kalınlaştır ve yazıları arkaplan resmine göre yeniden hizala ve boyutla.
User prompt
Panelin arkaplan resmini içindeki yazı ve işlevlere göre yeniden boyutlandır.
User prompt
Araştırma paneli içindeki bütün yazı ve işlevleri panelin içine sığacak şekilde yeniden düzenle.
User prompt
Panel sayfanın ortasında açılsın. Ama panel açık iken oyun ekranındaki yazıların hiç birisi görünmesin.
User prompt
Panel en ön planda açılsın oyundaki yazılar panel içinden görünmesin. Ayrıca seviye ile ilgili tüm yazı ve butonları bu panel büyüklüğüne oranla yeniden yerleştir içerisine.
User prompt
Bu araştırma kampı paneli sayfanın ortasında açılsın boyutu %100 olarak artır.
User prompt
Sol altta bulunan panel içeriğinin tamamını bu en son oluşturduğumuz panel içerisine aktar.
User prompt
Bu resmi 1 satır sağa taşı. Sonrasında araştırma kampı ismini ver ve bir resme bağlı bir açılır panel oluştur.
User prompt
Bu en son oluşturduğumuz resmin bir dosyasını oluştur
User prompt
Personel Dinlenme yerinin yanına bir resim oluştur
User prompt
Sol alta eklediğim panelin arkaplanı resmi oluştur
User prompt
Madenci Al yazısının altına eklediğim. Taşıyıcı Al yazısını sil.
/**** * 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 = false; 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 = false; }; 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 && self.factoryTarget.productBuffer > 0) { self.factoryTarget.productBuffer--; self.carrying = true; if (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 === "number") { self.shopTarget.productBuffer++; } self.carrying = false; } if (factoryList.length > 0 && factoryList[0].productBuffer > 0) { self.goToFactory(factoryList[0]); } else { self.setIdle(); } } } else if (self.state === 'idle') { // Look for product to carry if (factoryList.length > 0 && factoryList[0].productBuffer > 0) { self.goToFactory(factoryList[0]); } } }; 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 && shopList[0].productBuffer > 0) { canSpawn = true; } 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; 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 > 0) { // Product available, buy and leave self.targetShop.productBuffer--; money += 10; updateMoneyText(); self.hasBought = true; self.state = 'leaving'; self.leaveTarget = { x: self.x, y: -100 }; // leave upwards } else { // No product, wait in shop until product arrives // Do nothing, just stay here } } } } 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 self.productBuffer = 0; // products ready to be sold 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--; self.productBuffer++; 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 }); self.productBuffer = 0; // products available in shop return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Add a background image to the game 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 var buyMinerBtn = new Text2('Madenci Al (₺30)', { size: 36, fill: "#fff" }); buyMinerBtn.anchor.set(0.5, 0.5); buyMinerBtn.x = 400; buyMinerBtn.y = 100; LK.gui.top.addChild(buyMinerBtn); // (Removed 'Taşıyıcı Al' label below 'Madenci Al') var buyMineBtn = new Text2('Maden Aç (₺40)', { size: 36, fill: "#fff" }); buyMineBtn.anchor.set(0.5, 0.5); buyMineBtn.x = 900; buyMineBtn.y = 100; LK.gui.top.addChild(buyMineBtn); var buyFactoryBtn = new Text2('Fabrika Kur (₺60)', { size: 36, fill: "#fff" }); buyFactoryBtn.anchor.set(0.5, 0.5); buyFactoryBtn.x = 1500; buyFactoryBtn.y = 100; LK.gui.top.addChild(buyFactoryBtn); var buyCarrierBtn = new Text2('Taşıyıcı Al (₺25)', { size: 36, fill: "#fff" }); buyCarrierBtn.anchor.set(0.5, 0.5); buyCarrierBtn.x = 2000; buyCarrierBtn.y = 100; LK.gui.top.addChild(buyCarrierBtn); buyCarrierBtn.down = function () { if (money >= 25) { money -= 25; updateMoneyText(); spawnCarrier(); } }; // Button events buyMinerBtn.down = function () { if (money >= 30) { money -= 30; updateMoneyText(); spawnMiner(); } }; buyMineBtn.down = function () { if (money >= 40) { money -= 40; updateMoneyText(); spawnMine(); } }; buyFactoryBtn.down = function () { if (money >= 60) { money -= 60; updateMoneyText(); spawnFactory(); } }; // 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 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 '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); } } }; // 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 for (var i = 0; i < factoryList.length; i++) { var t = new Text2('Cevher: ' + factoryList[i].oreBuffer + '\nÜrün: ' + factoryList[i].productBuffer, { size: 36, fill: "#fff" }); t.anchor.set(0.5, 1); t.x = factoryList[i].x; t.y = factoryList[i].y - 80; game.addChild(t); statusTexts.push(t); } // Shops for (var i = 0; i < shopList.length; i++) { var t = new Text2('Ürün: ' + shopList[i].productBuffer, { size: 36, fill: "#fff" }); t.anchor.set(0.5, 1); t.x = shopList[i].x; t.y = shopList[i].y - 80; game.addChild(t); statusTexts.push(t); } } var statusTimer = LK.setInterval(updateStatusTexts, 400); // Prevent UI overlap with top left menu // (All UI is placed away from top left 100x100 px) buyMinerBtn.x = 400; buyMineBtn.x = 900; buyFactoryBtn.x = 1500; // --- 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
@@ -498,9 +498,8 @@
/****
* Game Code
****/
-// Çalışan paneli için yeni resim
// Add a background image to the game
var baseMoveMultiplier = 0.5; // Everyone moves 50% slower by default
function getMoveMultiplier(level) {
// Each level increases speed by 2% (so multiplier increases)
@@ -674,8 +673,17 @@
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 'Araştırma Kampı' label below the image
var researchCampLabel = new Text2('Araştırma Kampı', {
size: 36,
fill: "#fff"
@@ -683,90 +691,8 @@
researchCampLabel.anchor.set(0.5, 0);
researchCampLabel.x = researchCampImg.x;
researchCampLabel.y = researchCampImg.y + 90;
game.addChild(researchCampLabel);
-// --- ÇALIŞAN PANELİ (WORKER PANEL) ---
-// Panel container oluştur
-var workerPanel = new Container();
-game.addChild(workerPanel);
-// Araştırma Kampı'nın SAĞINA ekle (panel 300px genişliğinde, 60px boşluk bırak)
-var workerPanelImg = LK.getAsset('workerPanel', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: researchCampImg.x + 300 + 60,
- y: researchCampImg.y
-});
-workerPanel.addChild(workerPanelImg);
-// 'Çalışanlar' başlığı için resim ekle ve Araştırma Kampı'nın sağına yerleştir
-var workerTitleImg = LK.getAsset('city', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: workerPanelImg.x,
- y: workerPanelImg.y - workerPanelImg.height / 2 + 50,
- scaleX: 0.7,
- scaleY: 0.7
-});
-workerPanel.addChild(workerTitleImg);
-// Panel başlığı
-var workerPanelTitle = new Text2('Çalışanlar', {
- size: 36,
- fill: "#fff"
-});
-workerPanelTitle.anchor.set(0.5, 0);
-workerPanelTitle.x = workerPanelImg.x;
-workerPanelTitle.y = workerPanelImg.y - workerPanelImg.height / 2 + 20;
-workerPanel.addChild(workerPanelTitle);
-// Panelde çalışan satın alma butonları (örnek: Madenci, Taşıyıcı, Araştırmacı)
-var workerBtnYStart = workerPanelImg.y - workerPanelImg.height / 2 + 80;
-var workerBtnSpacing = 90;
-// Madenci satın al
-var buyMinerPanelBtn = new Text2('Madenci Al (₺30)', {
- size: 32,
- fill: "#fff"
-});
-buyMinerPanelBtn.anchor.set(0.5, 0.5);
-buyMinerPanelBtn.x = workerPanelImg.x;
-buyMinerPanelBtn.y = workerBtnYStart;
-workerPanel.addChild(buyMinerPanelBtn);
-buyMinerPanelBtn.down = function () {
- if (money >= 30) {
- money -= 30;
- updateMoneyText();
- spawnMiner();
- }
-};
-// Taşıyıcı satın al
-var buyCarrierPanelBtn = new Text2('Taşıyıcı Al (₺25)', {
- size: 32,
- fill: "#fff"
-});
-buyCarrierPanelBtn.anchor.set(0.5, 0.5);
-buyCarrierPanelBtn.x = workerPanelImg.x;
-buyCarrierPanelBtn.y = workerBtnYStart + workerBtnSpacing;
-workerPanel.addChild(buyCarrierPanelBtn);
-buyCarrierPanelBtn.down = function () {
- if (money >= 25) {
- money -= 25;
- updateMoneyText();
- spawnCarrier();
- }
-};
-// Araştırmacı satın al
-var buyResearcherPanelBtn = new Text2('Araştırmacı Al (₺40)', {
- size: 32,
- fill: "#fff"
-});
-buyResearcherPanelBtn.anchor.set(0.5, 0.5);
-buyResearcherPanelBtn.x = workerPanelImg.x;
-buyResearcherPanelBtn.y = workerBtnYStart + workerBtnSpacing * 2;
-workerPanel.addChild(buyResearcherPanelBtn);
-buyResearcherPanelBtn.down = function () {
- if (money >= 40) {
- money -= 40;
- updateMoneyText();
- spawnResearcher();
- }
-};
// Create a panel for Araştırma Kampı (hidden by default)
var researchCampPanelBg = LK.getAsset('levelPanelBg', {
anchorX: 0.5,
anchorY: 0.5,
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