User prompt
Panel içeriği görünmüyor. Sadece arkaplan görünüyor.
User prompt
Bunu düzelt.
User prompt
En son oluşturduğumuz panel oyunun ekranında görünmüyor. Sol alt kenara hizalı şekilde yerleştir.
User prompt
Ekranın sol altına bir panel ekle. Bu panelde "Askerin ve Kulelerin, Atış Gücü ve Atış Hızı yükseltme" Ayrıca "Herhangi bir kulenin canı %50 altına düşünce otomatik tamir etmeyi aktif etme" butonları olsun. Bunun maliyeti Her kule başı 100 ve katları coin olsun. Otomatik tamir aktif olan kulenin üzerinde tamir iconu belirsin.
User prompt
Her wave sonrası gelen zombilerden düşen coin oranı %50 artsın.
User prompt
Her wave sonrası gelen zombilerden düşen coin oranı %15 artsın.
User prompt
Zombiler, kule ve tuzak varsa önce onlara saldırsınlar. Kule ve tuzakların can barı olsun. Sadece kulelerin üzerinde tamir et butonu olsun. Belli bir maliyeti olsun.
User prompt
Zombiler Base %50 oranında yaklaşınca asker saldırmaya başlasın.
User prompt
Askerin menzil alanı, base zombiler %50 oranında olsun.
User prompt
Asker menzil alanı, %50 düşür.
User prompt
Zombiler harita dışından gelsinler.
User prompt
Bina ve yükseltme maliyeti, her satın alımda 2 kat artsın.
User prompt
Her wave seviyesinde, %15 daha fazla ve daha güçlü zombiler saldırsın.
User prompt
Oyuncu mermi sayısını yarıya düşür.
User prompt
Düzenle ve düzelt.
User prompt
Dron dönüş hareketi keskin olmasın.
User prompt
Dron etkin alanını %80 düşür.
User prompt
Dron ani dönüşler yapmasın. Havada uçuyor gibi gitsin. Ayrıca, bir hortum çekiyor gibi coin çekim alanı olsun.
User prompt
Coinleri toplamak için Dron oluştur.
User prompt
Oyuncu otomatik mermi sıkar
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'healthText.style.fill = "#00ff00";' Line Number: 396
Code edit (1 edits merged)
Please save this source code
User prompt
Zombie Base Defense
Initial prompt
Oyuncuya ait oyun ekranının ortasında AnaBase var. Oyuncunun karakteri bu base doğru gelen, zombi istilasına karşı tüfekle savunma yapıyor. Her wave sonunda daha fazla zombi istilası geliyor. Bu base de bir savunma kule çeşitliği var. Zombilerden kazanılan coin ile, bu kulelerden satın alınıyor. Kuleler zombilere yavaş yavaş silah sıkıyor. Satın alınan kuleler, base yakınına otomatik rastgele yerleştiriliyor. Ancak yerleştirilen herhangi bir şey, üst üste gelmeyecek şekilde tamamen base yakınından başlayarak rastgele konumlanıyor. Kuleler haricinde tuzaklar da var, bu tuzaklar zombileri yavaşlatmaya veya öldürmeye yarıyor. Anabase tıklayınca, yükseltme ve satın alma butonlarının olduğu panel açılıyor. Kazandığımız coinleri burada kullanıyoruz. Böylelikle, sonsuza dek gelen zombi akınına karşı hayatta kalmaya çalışıyoruz.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Base = Container.expand(function () { var self = Container.call(this); var baseGraphics = self.attachAsset('base', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.takeDamage = function (damage) { self.health -= damage; tween(baseGraphics, { tint: 0xff0000 }, { duration: 100, onFinish: function onFinish() { tween(baseGraphics, { tint: 0xffffff }, { duration: 100 }); } }); if (self.health <= 0) { LK.showGameOver(); } }; self.down = function (x, y, obj) { if (!upgradePanel.visible) { upgradePanel.visible = true; } else { upgradePanel.visible = false; } }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.damage = 1; self.dx = 0; self.dy = 0; self.setDirection = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.dx = dx / distance * self.speed; self.dy = dy / distance * self.speed; self.rotation = Math.atan2(dy, dx); } }; self.update = function () { self.x += self.dx; self.y += self.dy; }; return self; }); var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.fireRate = 40; self.fireCooldown = 0; self.update = function () { if (self.fireCooldown > 0) { self.fireCooldown--; } // Find closest zombie for automatic shooting if (self.fireCooldown === 0 && zombies.length > 0) { var closestZombie = null; var closestDistance = Infinity; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var dx = zombie.x - self.x; var dy = zombie.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < closestDistance) { closestDistance = distance; closestZombie = zombie; } } if (closestZombie) { self.shoot(closestZombie.x, closestZombie.y); } } }; self.shoot = function (targetX, targetY) { if (self.fireCooldown > 0) return; var bullet = new Bullet(); bullet.x = self.x; bullet.y = self.y; bullet.setDirection(targetX, targetY); bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); self.fireCooldown = self.fireRate; }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.value = 10; self.lifetime = 300; self.update = function () { self.lifetime--; coinGraphics.alpha = Math.min(1, self.lifetime / 100); }; return self; }); var Drone = Container.expand(function () { var self = Container.call(this); var vacuumField = self.attachAsset('vacuumField', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1, scaleX: 0.445, scaleY: 0.445 }); var droneGraphics = self.attachAsset('drone', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.target = null; self.collectRange = 22; // Reduced from 50 to achieve 80% area reduction self.vacuumRange = 89; // Reduced from 200 to achieve 80% area reduction self.vacuumPower = 0.15; // Strength of vacuum pull self.floatOffset = 0; self.floatSpeed = 0.05; self.vx = 0; self.vy = 0; self.update = function () { // Floating animation self.floatOffset += self.floatSpeed; droneGraphics.y = Math.sin(self.floatOffset) * 10; // Vacuum field pulsing animation vacuumField.scaleX = 0.445 + Math.sin(self.floatOffset * 2) * 0.045; vacuumField.scaleY = 0.445 + Math.sin(self.floatOffset * 2) * 0.045; vacuumField.alpha = 0.05 + Math.sin(self.floatOffset * 3) * 0.03; // Find closest coin var closestCoin = null; var closestDistance = Infinity; for (var i = 0; i < coins.length; i++) { var coin = coins[i]; var dx = coin.x - self.x; var dy = coin.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < closestDistance) { closestDistance = distance; closestCoin = coin; } } self.target = closestCoin; // Calculate desired velocity towards target var desiredVx = 0; var desiredVy = 0; if (self.target) { var dx = self.target.x - self.x; var dy = self.target.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > self.collectRange) { desiredVx = dx / distance * self.speed; desiredVy = dy / distance * self.speed; } } else { // Return to base when no coins var dx = base.x - self.x; var dy = base.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 150) { desiredVx = dx / distance * self.speed; desiredVy = dy / distance * self.speed; } } // Smoothly interpolate current velocity towards desired velocity self.vx = self.vx * 0.85 + desiredVx * 0.15; self.vy = self.vy * 0.85 + desiredVy * 0.15; // Apply smoothed velocity self.x += self.vx; self.y += self.vy; // Apply vacuum effect to nearby coins for (var i = 0; i < coins.length; i++) { var coin = coins[i]; var dx = self.x - coin.x; var dy = self.y - coin.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.vacuumRange && distance > 0) { // Pull coins towards drone var pullStrength = (1 - distance / self.vacuumRange) * self.vacuumPower; coin.x += dx / distance * pullStrength * distance; coin.y += dy / distance * pullStrength * distance; } } }; return self; }); var Tower = Container.expand(function () { var self = Container.call(this); var towerGraphics = self.attachAsset('tower', { anchorX: 0.5, anchorY: 0.5 }); // Health bar self.maxHealth = 20; self.health = self.maxHealth; self.healthBar = new Text2('', { size: 24, fill: 0x00ff00 }); self.healthBar.anchor.set(0.5, 1); self.healthBar.y = -50; self.addChild(self.healthBar); self.updateHealthBar = function () { self.healthBar.setText(self.health + '/' + self.maxHealth); if (self.health > self.maxHealth * 0.5) { self.healthBar.fill = 0x00ff00; } else if (self.health > self.maxHealth * 0.25) { self.healthBar.fill = 0xffff00; } else { self.healthBar.fill = 0xff0000; } }; self.updateHealthBar(); // Repair button self.repairCost = 30; self.repairButton = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, y: 60, scaleX: 0.5, scaleY: 0.5 }); self.repairText = new Text2('Tamir: ' + self.repairCost, { size: 28, fill: 0xffffff }); self.repairText.anchor.set(0.5, 0.5); self.repairText.y = 60; self.addChild(self.repairText); self.repairButton.visible = false; self.repairText.visible = false; self.down = function (x, y, obj) { // Show repair button if tower is damaged if (self.health < self.maxHealth) { self.repairButton.visible = true; self.repairText.visible = true; } }; self.repairButton.down = function () { if (coinAmount >= self.repairCost && self.health < self.maxHealth) { coinAmount -= self.repairCost; self.health = self.maxHealth; self.updateHealthBar(); self.repairButton.visible = false; self.repairText.visible = false; } }; self.fireRate = 60; self.fireCooldown = 0; self.range = 300; self.damage = 1; self.takeDamage = function (dmg) { self.health -= dmg; self.updateHealthBar(); if (self.health <= 0) { self.destroy(); var idx = towers.indexOf(self); if (idx !== -1) towers.splice(idx, 1); } }; self.update = function () { if (self.fireCooldown > 0) { self.fireCooldown--; return; } var closestZombie = null; var closestDistance = self.range; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var dx = zombie.x - self.x; var dy = zombie.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < closestDistance) { closestDistance = distance; closestZombie = zombie; } } if (closestZombie) { var bullet = new Bullet(); bullet.x = self.x; bullet.y = self.y; bullet.setDirection(closestZombie.x, closestZombie.y); bullet.damage = self.damage; bullets.push(bullet); game.addChild(bullet); self.fireCooldown = self.fireRate; } // Hide repair button if not needed if (self.health >= self.maxHealth) { self.repairButton.visible = false; self.repairText.visible = false; } // --- AUTO REPAIR LOGIC --- if (self.autoRepair && self.health < self.maxHealth * 0.5) { // Only repair if not already at max and below 50% if (!self.repairIcon) { self.repairIcon = new Text2('🔧', { size: 48, fill: 0x00ffcc }); self.repairIcon.anchor.set(0.5, 0.5); self.repairIcon.y = -80; self.addChild(self.repairIcon); } // Repair instantly, cost already paid self.health = self.maxHealth; self.updateHealthBar(); } else if (self.repairIcon) { self.removeChild(self.repairIcon); self.repairIcon = null; } }; return self; }); var Trap = Container.expand(function () { var self = Container.call(this); var trapGraphics = self.attachAsset('trap', { anchorX: 0.5, anchorY: 0.5 }); // Health bar self.maxHealth = 10; self.health = self.maxHealth; self.healthBar = new Text2('', { size: 20, fill: 0x00ff00 }); self.healthBar.anchor.set(0.5, 1); self.healthBar.y = -35; self.addChild(self.healthBar); self.updateHealthBar = function () { self.healthBar.setText(self.health + '/' + self.maxHealth); if (self.health > self.maxHealth * 0.5) { self.healthBar.fill = 0x00ff00; } else if (self.health > self.maxHealth * 0.25) { self.healthBar.fill = 0xffff00; } else { self.healthBar.fill = 0xff0000; } }; self.updateHealthBar(); self.takeDamage = function (dmg) { self.health -= dmg; self.updateHealthBar(); if (self.health <= 0) { self.destroy(); var idx = traps.indexOf(self); if (idx !== -1) traps.splice(idx, 1); } }; self.damage = 2; self.cooldown = 0; self.maxCooldown = 120; self.update = function () { if (self.cooldown > 0) { self.cooldown--; trapGraphics.alpha = 0.5; return; } trapGraphics.alpha = 1; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; if (self.intersects(zombie)) { zombie.takeDamage(self.damage); self.cooldown = self.maxCooldown; break; } } }; return self; }); var UpgradePanel = Container.expand(function () { var self = Container.call(this); var panelGraphics = self.attachAsset('upgradePanel', { anchorX: 0.5, anchorY: 0.5 }); var towerButton = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, y: -200 }); var trapButton = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, y: -50 }); var healthButton = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, y: 100 }); var closeButton = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, y: 250, scaleX: 0.3, scaleY: 0.8 }); self.towerText = new Text2('Tower - ' + towerCost + ' coins', { size: 40, fill: 0xFFFFFF }); self.towerText.anchor.set(0.5, 0.5); self.towerText.y = -200; self.addChild(self.towerText); self.trapText = new Text2('Trap - ' + trapCost + ' coins', { size: 40, fill: 0xFFFFFF }); self.trapText.anchor.set(0.5, 0.5); self.trapText.y = -50; self.addChild(self.trapText); self.healthText = new Text2('Repair Base - ' + healthCost + ' coins', { size: 40, fill: 0xFFFFFF }); self.healthText.anchor.set(0.5, 0.5); self.healthText.y = 100; self.addChild(self.healthText); self.closeText = new Text2('Close', { size: 40, fill: 0xFFFFFF }); self.closeText.anchor.set(0.5, 0.5); self.closeText.y = 250; self.addChild(self.closeText); towerButton.down = function () { if (coinAmount >= towerCost) { coinAmount -= towerCost; towerCost *= 2; self.towerText.setText('Tower - ' + towerCost + ' coins'); var tower = new Tower(); var angle = Math.random() * Math.PI * 2; var distance = 250 + Math.random() * 100; tower.x = base.x + Math.cos(angle) * distance; tower.y = base.y + Math.sin(angle) * distance; // Inherit auto-repair if already enabled if (typeof autoRepairActive !== "undefined" && autoRepairActive.length > 0) { tower.autoRepair = true; autoRepairActive.push(tower); } towers.push(tower); game.addChild(tower); LK.getSound('build').play(); self.visible = false; } }; trapButton.down = function () { if (coinAmount >= trapCost) { coinAmount -= trapCost; trapCost *= 2; self.trapText.setText('Trap - ' + trapCost + ' coins'); var trap = new Trap(); var angle = Math.random() * Math.PI * 2; var distance = 200 + Math.random() * 150; trap.x = base.x + Math.cos(angle) * distance; trap.y = base.y + Math.sin(angle) * distance; traps.push(trap); game.addChild(trap); LK.getSound('build').play(); self.visible = false; } }; healthButton.down = function () { if (coinAmount >= healthCost && base.health < base.maxHealth) { coinAmount -= healthCost; healthCost *= 2; self.healthText.setText('Repair Base - ' + healthCost + ' coins'); base.health = Math.min(base.health + 20, base.maxHealth); self.visible = false; } }; closeButton.down = function () { self.visible = false; }; return self; }); var Zombie = Container.expand(function () { var self = Container.call(this); var zombieGraphics = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); self.health = 2; self.speed = 1.5; self.damage = 1; self.value = 10; self.update = function () { // Priority: nearest tower, then nearest trap, then base var target = null; var minDist = Infinity; // Find closest alive tower for (var i = 0; i < towers.length; i++) { var t = towers[i]; if (t.health > 0) { var dx = t.x - self.x; var dy = t.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < minDist) { minDist = dist; target = t; } } } // If no tower, find closest alive trap if (!target) { for (var i = 0; i < traps.length; i++) { var tr = traps[i]; if (tr.health > 0) { var dx = tr.x - self.x; var dy = tr.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < minDist) { minDist = dist; target = tr; } } } } // If no tower or trap, target base if (!target) { target = base; } var dx = target.x - self.x; var dy = target.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; self.takeDamage = function (damage) { self.health -= damage; tween(zombieGraphics, { tint: 0xff0000 }, { duration: 100, onFinish: function onFinish() { tween(zombieGraphics, { tint: 0xffffff }, { duration: 100 }); } }); if (self.health <= 0) { return true; } return false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ var zombies = []; var bullets = []; var coins = []; var towers = []; var traps = []; var base; var character; var upgradePanel; var drone; var coinAmount = 0; var towerCost = 50; var trapCost = 30; var healthCost = 20; var wave = 1; var zombiesInWave = 5; var zombiesSpawned = 0; var waveDelay = 180; var spawnTimer = 0; // Coin drop multiplier, increases by 50% after each wave var coinDropMultiplier = 1.0; base = game.addChild(new Base()); base.x = 1024; base.y = 1366; character = game.addChild(new Character()); character.x = base.x; character.y = base.y - 150; drone = game.addChild(new Drone()); drone.x = base.x + 100; drone.y = base.y; upgradePanel = game.addChild(new UpgradePanel()); upgradePanel.x = 1024; upgradePanel.y = 1366; upgradePanel.visible = false; var coinText = new Text2('Coins: 0', { size: 60, fill: 0xFFFF00 }); coinText.anchor.set(0.5, 0); LK.gui.top.addChild(coinText); var waveText = new Text2('Wave: 1', { size: 60, fill: 0xFFFFFF }); waveText.anchor.set(0.5, 0); waveText.y = 70; LK.gui.top.addChild(waveText); var healthText = new Text2('Base Health: 100', { size: 50, fill: 0x00FF00 }); healthText.anchor.set(0.5, 1); LK.gui.bottom.addChild(healthText); // --- BOTTOM LEFT UPGRADE PANEL --- var panelWidth = 650; var panelHeight = 420; var bottomPanel = new Container(); var panelBg = LK.getAsset('upgradePanel', { anchorX: 0, anchorY: 1, width: panelWidth, height: panelHeight, x: 0, y: 0 // Panel background y=0, so the bottom aligns with the container's y=0 }); bottomPanel.addChild(panelBg); // Add all panel content to the panel container so they are visible bottomPanel.addChild(firepowerButton); bottomPanel.addChild(firepowerText); bottomPanel.addChild(firerateButton); bottomPanel.addChild(firerateText); bottomPanel.addChild(autoRepairButton); bottomPanel.addChild(autoRepairText); // Add to GUI bottom left (avoid 0,0 menu area) bottomPanel.x = 0; bottomPanel.y = 0; // y=0 in LK.gui.bottomLeft is the bottom of the screen, so panelBg.anchorY=1 aligns its bottom to this point LK.gui.bottomLeft.addChild(bottomPanel); // --- BUTTON LOGIC --- firepowerButton.down = function () { if (coinAmount >= firepowerCost) { coinAmount -= firepowerCost; firepowerCost *= 2; firepowerText.setText('Atış Gücü + (' + firepowerCost + ')'); // Upgrade character and all towers character.damage = (character.damage || 1) + 1; for (var i = 0; i < towers.length; i++) { towers[i].damage = (towers[i].damage || 1) + 1; } } }; firerateButton.down = function () { if (coinAmount >= firerateCost) { coinAmount -= firerateCost; firerateCost *= 2; firerateText.setText('Atış Hızı + (' + firerateCost + ')'); // Upgrade character and all towers character.fireRate = Math.max(5, Math.floor(character.fireRate * 0.85)); for (var i = 0; i < towers.length; i++) { towers[i].fireRate = Math.max(5, Math.floor(towers[i].fireRate * 0.85)); } } }; autoRepairButton.down = function () { var needed = towers.length * autoRepairCost; if (towers.length > 0 && coinAmount >= needed) { coinAmount -= needed; // Mark all towers as auto-repair enabled for (var i = 0; i < towers.length; i++) { towers[i].autoRepair = true; if (!autoRepairActive.includes(towers[i])) autoRepairActive.push(towers[i]); } autoRepairText.setText('Otomatik Tamir: Açık'); } }; game.down = function (x, y, obj) { if (!upgradePanel.visible) { character.shoot(x, y); } }; game.update = function () { coinText.setText('Coins: ' + coinAmount); waveText.setText('Wave: ' + wave); healthText.setText('Base Health: ' + base.health); if (base.health > 50) { healthText.fill = 0x00ff00; } else if (base.health > 20) { healthText.fill = 0xffff00; } else { healthText.fill = 0xff0000; } if (waveDelay > 0) { waveDelay--; } else if (zombiesSpawned < zombiesInWave) { spawnTimer++; if (spawnTimer >= 60) { spawnTimer = 0; zombiesSpawned++; var zombie = new Zombie(); var scale = Math.pow(1.15, wave - 1); zombie.health = Math.round(zombie.health * scale); zombie.speed = zombie.speed * scale; zombie.damage = Math.round(zombie.damage * scale); zombie.value = Math.round(zombie.value * scale); // Spawn zombies from outside the map edges var edge = Math.floor(Math.random() * 4); // 0: left, 1: right, 2: top, 3: bottom var spawnX, spawnY; if (edge === 0) { // left spawnX = -100; spawnY = Math.random() * 2732; } else if (edge === 1) { // right spawnX = 2048 + 100; spawnY = Math.random() * 2732; } else if (edge === 2) { // top spawnX = Math.random() * 2048; spawnY = -100; } else { // bottom spawnX = Math.random() * 2048; spawnY = 2732 + 100; } zombie.x = spawnX; zombie.y = spawnY; zombies.push(zombie); game.addChild(zombie); } } else if (zombies.length === 0) { wave++; zombiesInWave = Math.round((5 + wave * 2) * Math.pow(1.15, wave - 1)); zombiesSpawned = 0; waveDelay = 180; // Increase coin drop multiplier by 50% after each wave coinDropMultiplier *= 1.5; } for (var i = zombies.length - 1; i >= 0; i--) { var zombie = zombies[i]; var attacked = false; // Check towers for (var ti = 0; ti < towers.length; ti++) { var tower = towers[ti]; if (tower.health > 0 && zombie.intersects(tower)) { tower.takeDamage(zombie.damage); zombie.destroy(); zombies.splice(i, 1); attacked = true; break; } } if (attacked) continue; // Check traps for (var trpi = 0; trpi < traps.length; trpi++) { var trap = traps[trpi]; if (trap.health > 0 && zombie.intersects(trap)) { trap.takeDamage(zombie.damage); zombie.destroy(); zombies.splice(i, 1); attacked = true; break; } } if (attacked) continue; // Check base if (zombie.intersects(base)) { base.takeDamage(zombie.damage); zombie.destroy(); zombies.splice(i, 1); continue; } for (var j = bullets.length - 1; j >= 0; j--) { var bullet = bullets[j]; if (zombie.intersects(bullet)) { LK.getSound('zombieHit').play(); if (zombie.takeDamage(bullet.damage)) { var coin = new Coin(); coin.x = zombie.x; coin.y = zombie.y; // Apply coin drop multiplier coin.value = Math.round(zombie.value * coinDropMultiplier); coins.push(coin); game.addChild(coin); zombie.destroy(); zombies.splice(i, 1); } bullet.destroy(); bullets.splice(j, 1); break; } } } for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.x < -100 || bullet.x > 2148 || bullet.y < -100 || bullet.y > 2832) { bullet.destroy(); bullets.splice(i, 1); } } for (var i = coins.length - 1; i >= 0; i--) { var coin = coins[i]; if (coin.lifetime <= 0) { coin.destroy(); coins.splice(i, 1); continue; } var dx = character.x - coin.x; var dy = character.y - coin.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 100) { coinAmount += coin.value; LK.getSound('coinCollect').play(); coin.destroy(); coins.splice(i, 1); continue; } // Drone coin collection var droneDx = drone.x - coin.x; var droneDy = drone.y - coin.y; var droneDistance = Math.sqrt(droneDx * droneDx + droneDy * droneDy); if (droneDistance < drone.collectRange) { coinAmount += coin.value; LK.getSound('coinCollect').play(); coin.destroy(); coins.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -654,64 +654,13 @@
x: 0,
y: 0 // Panel background y=0, so the bottom aligns with the container's y=0
});
bottomPanel.addChild(panelBg);
-// Firepower Upgrade Button
-var firepowerCost = 100;
-var firepowerButton = LK.getAsset('upgradeButton', {
- anchorX: 0,
- anchorY: 0,
- x: 30,
- y: panelHeight - 120,
- width: 300,
- height: 90
-});
-var firepowerText = new Text2('Atış Gücü + (100)', {
- size: 36,
- fill: 0xffffff
-});
-firepowerText.anchor.set(0, 0.5);
-firepowerText.x = 60;
-firepowerText.y = panelHeight - 75;
+// Add all panel content to the panel container so they are visible
bottomPanel.addChild(firepowerButton);
bottomPanel.addChild(firepowerText);
-// Fire Rate Upgrade Button
-var firerateCost = 100;
-var firerateButton = LK.getAsset('upgradeButton', {
- anchorX: 0,
- anchorY: 0,
- x: 340,
- y: panelHeight - 120,
- width: 300,
- height: 90
-});
-var firerateText = new Text2('Atış Hızı + (100)', {
- size: 36,
- fill: 0xffffff
-});
-firerateText.anchor.set(0, 0.5);
-firerateText.x = 370;
-firerateText.y = panelHeight - 75;
bottomPanel.addChild(firerateButton);
bottomPanel.addChild(firerateText);
-// Auto Repair Toggle Button
-var autoRepairCost = 100;
-var autoRepairActive = [];
-var autoRepairButton = LK.getAsset('upgradeButton', {
- anchorX: 0,
- anchorY: 0,
- x: 30,
- y: panelHeight - 220,
- width: 610,
- height: 90
-});
-var autoRepairText = new Text2('Otomatik Tamir: Kapalı (100 x kule)', {
- size: 36,
- fill: 0xffffff
-});
-autoRepairText.anchor.set(0, 0.5);
-autoRepairText.x = 60;
-autoRepairText.y = panelHeight - 175;
bottomPanel.addChild(autoRepairButton);
bottomPanel.addChild(autoRepairText);
// Add to GUI bottom left (avoid 0,0 menu area)
bottomPanel.x = 0;
Askeri karakol, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Askeri Kule, gerçekçi, üstten görünüm, yazısız. In-Game asset. High contrast. No shadows
Askeri drone, üstten görünüm, gerçekçi, yazısız. In-Game asset. 2d. High contrast. No shadows
Coin, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Namusu olmayan Teknolojik askeri saldırı kulesi, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Namlusu olmayan, Teknolojik askeri kule, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Namlusu olmayan, Teknolojik askeri kule, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Tuzak üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Füze, üstten görünüm, gerçekçi, yazısız. In-Game asset. High contrast. No shadows
Patlama, gerçekçi, üstten görünüm, yazısız. In-Game asset. High contrast. No shadows