User prompt
Asker dönüşünü geri al.
User prompt
Askerin yönü şuan aşağı bakıyor. Mermi nereye sıkarsa oraya bakmasını sağla.
User prompt
10 farklı zombi resim dosyası oluştur, 10 farklı kule resim dosyası oluştur.
User prompt
Panel herşeyden önde açılsın. Kule, zombi, mermiler, tuzak, base panelin boyunca otomatik gizlensin.
User prompt
Yeterli coin yoksa tamir olmasın.
User prompt
Otomatik Tamir olan her kule, 100 coin harcama yapsın.
User prompt
Sorunu düzelt ve tamamen sil.
User prompt
Otomatik Tamir Ücreti, Kule başı her tamir de 100 coin maliyeti olsun.
User prompt
Otomatik Tamir Maliyeti 2000 coin olsun.
User prompt
Otomatik Tamir butonu yazısı, Buton içine sığacak şekilde konumlandır.
User prompt
Panel içeriğini ve arkaplanını hizalı olacak şekilde düzenle.
User prompt
Buton boyutları, anabase yükseltme butonları ile aynı olsun ve hizalı olsun. En alt satıra da close butonunu taşırsın.
User prompt
Son eklediğin butonları, close üzerine hizalı ve tek sıra olacak şekilde alt alta yeniden boyutlandır ve yerleştir.
User prompt
Son eklediğin paneli, mevcut panelin içerisinde hizalı olacak şekilde ve boyutu düzenli olarak şekilde yeniden yerleştir.
User prompt
Bu yükseltme panelini, olduğu gibi base tıkanınca açılan panelinin içine taşı.
User prompt
Bu yükseltme panelini, olduğu gibi base panelinin içine taşı.
User prompt
Satın al butonlarını da ekle altına.
User prompt
Panelin boyutunu küçült.
User prompt
Hayır düzelmemiş. Bağımsız şekilde özel kod ile düzelt.
User prompt
Düzelt.
User prompt
Wave yazısının altında buton görünmüyor. Bu butonu oluştur ve yerleştir.
User prompt
En son oluşturduğumuz panelin butonunu, Wave yazısının altına oluştur.
User prompt
Yine görünmüyor. Panel butonları ve yazılarını, arkaplanın önünde göster.
User prompt
Düzelt.
User prompt
Please fix the bug: 'firepowerButton is not defined' in or related to this line: 'bottomPanel.addChild(firepowerButton);' Line Number: 684
/****
* 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);
// --- BASE UPGRADE PANEL (moved inside base upgrade popup) ---
// Panel width/height and button size/spacing match main upgradePanel
var panelWidth = 600;
var panelHeight = 420;
var bottomPanel = new Container();
var panelBg = LK.getAsset('upgradePanel', {
anchorX: 0.5,
anchorY: 0.5,
width: panelWidth,
height: panelHeight,
x: 0,
y: 0
});
bottomPanel.addChild(panelBg);
// Use same button size as main upgradePanel (upgradeButton asset, no scale)
var buttonWidth = 500;
var buttonHeight = 100;
var buttonSpacing = 20;
var startY = -panelHeight / 2 + buttonHeight / 2 + 20;
// Firepower Upgrade Button
var firepowerCost = 100;
var firepowerButton = LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: startY,
width: buttonWidth,
height: buttonHeight
});
var firepowerText = new Text2('Atış Gücü + (100)', {
size: 40,
fill: 0xffffff
});
firepowerText.anchor.set(0.5, 0.5);
firepowerText.x = 0;
firepowerText.y = startY;
bottomPanel.addChild(firepowerButton);
bottomPanel.addChild(firepowerText);
// Fire Rate Upgrade Button
var firerateCost = 100;
var firerateButton = LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: startY + buttonHeight + buttonSpacing,
width: buttonWidth,
height: buttonHeight
});
var firerateText = new Text2('Atış Hızı + (100)', {
size: 40,
fill: 0xffffff
});
firerateText.anchor.set(0.5, 0.5);
firerateText.x = 0;
firerateText.y = startY + buttonHeight + buttonSpacing;
bottomPanel.addChild(firerateButton);
bottomPanel.addChild(firerateText);
// Auto Repair Toggle Button
var autoRepairCost = 2000;
var autoRepairActive = [];
var autoRepairButton = LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: startY + 2 * (buttonHeight + buttonSpacing),
width: buttonWidth,
height: buttonHeight
});
var autoRepairText = new Text2('Otomatik Tamir: Kapalı (100 x kule)', {
size: 30,
// Reduced size to fit better in button
fill: 0xffffff
});
autoRepairText.anchor.set(0.5, 0.5);
autoRepairText.x = 0;
autoRepairText.y = startY + 2 * (buttonHeight + buttonSpacing);
bottomPanel.addChild(autoRepairButton);
bottomPanel.addChild(autoRepairText);
// Close Button (moved to bottom, same size as others)
var closeButtonY = startY + 3 * (buttonHeight + buttonSpacing);
var closeButton = LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: closeButtonY,
width: buttonWidth,
height: buttonHeight
});
var closeText = new Text2('Kapat', {
size: 40,
fill: 0xffffff
});
closeText.anchor.set(0.5, 0.5);
closeText.x = 0;
closeText.y = closeButtonY;
bottomPanel.addChild(closeButton);
bottomPanel.addChild(closeText);
// Center and align bottomPanel background and content inside upgradePanel
bottomPanel.x = 0;
bottomPanel.y = panelHeight / 2 + 40; // Place just below main upgradePanel content, visually aligned
panelBg.x = 0;
panelBg.y = 0;
// Center all buttons/texts horizontally (already x:0), ensure vertical stacking is visually centered
firepowerButton.x = 0;
firepowerText.x = 0;
firerateButton.x = 0;
firerateText.x = 0;
autoRepairButton.x = 0;
autoRepairText.x = 0;
closeButton.x = 0;
closeText.x = 0;
// Add to upgradePanel
upgradePanel.addChild(bottomPanel);
// Close logic for new closeButton
closeButton.down = function () {
upgradePanel.visible = false;
};
// --- BUTTON LOGIC (now inside base upgrade panel) ---
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
@@ -699,9 +699,9 @@
firerateText.y = startY + buttonHeight + buttonSpacing;
bottomPanel.addChild(firerateButton);
bottomPanel.addChild(firerateText);
// Auto Repair Toggle Button
-var autoRepairCost = 100;
+var autoRepairCost = 2000;
var autoRepairActive = [];
var autoRepairButton = LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
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