User prompt
Please fix the bug: 'TypeError: self.showHeadshotEffect is not a function' in or related to this line: 'self.showHeadshotEffect();' Line Number: 101 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
düşmanlar tek vuruşta öldüğünde headshot efekti çıksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
upgrade damage butonuna tıkladığımızda bize verdiği hasar biraz azalsın
User prompt
upgrade damage sisteminde hesaplama hatası var. oyun yenilendiğinde masraf azalıyor. onu düzelt
User prompt
hasarı yükselt sisteminde bir hata var. düzelt
User prompt
hasarı yükselt sisteminde bir hata var. düzelt
User prompt
ayarlar ekranındaki yazılar ve butonlar , katman olarak ayarlar ekranının üzerinde olsun
User prompt
ayarlar ekranı katman olarak en üstte olsun
User prompt
ayarlar ekranı açıldığında oyunu duraklat . ve ayarlar ekranı katman olarak en üstte olsun
User prompt
oyun ilk açıldığında bir eğitici ekle. otomatik olarak açılsın ve oyunu anlatsın. her oyuncuya sadece 1 kere gözüksün ve sağ üst tarafında çarpı işareti olsun , oradan kapatılsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
butonların üzerindeki yazılar gözükmüyor
User prompt
dalga arttıkça ekrana tıkladığımızda gelen para da artsın
User prompt
ekrana tıkladığımızda altın ikonu yukarı doğru yükselsin ve kısa bir süre sonra kaybolsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ekrana tıkladığımızda biraz altın versin
User prompt
bosslar aşırı güçlü olsun
User prompt
bosslar çok güçlü olsun
User prompt
oyun hızını belirledeğimiz butonda sadece 1x ve 2x hızları olsun
User prompt
alt tarafa oyun hızını yükseltebileceğimiz bir buton ekle. her tıkladığımızda hızlansın , 1x , 2x , 3x , 4x , 5x hızları olsun . 5x hıza geldiğinde tekrar tıklayınca 1x hız'a dönsün
Code edit (1 edits merged)
Please save this source code
User prompt
hasar yükseltme yapıldığında daha fazla hasar artsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
saldırı hızı yükseltmesini kaldır. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
yaratıklar öldüğünde daha fazla gold versin
User prompt
hasar yükselt butonuna basıldığında sadece hasar yükselsin , hızı yükselt butonuna basıldığında sadece saldırı hızını yükselt ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
hero çağır butonunu kaldır
User prompt
prestij butonuna bastığımızda yükseltmeler de sıfırlansın. fakat karakter gelişimi 1.5x artsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('titan', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 100; self.health = self.maxHealth; self.goldReward = 20; self.isBoss = false; self.waveNumber = 1; // Health bar background self.healthBarBg = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.3 }); self.healthBarBg.tint = 0x333333; self.healthBarBg.y = -enemyGraphics.height / 2 - 30; self.addChild(self.healthBarBg); // Health bar fill self.healthBarFill = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.3 }); self.healthBarFill.tint = 0x27ae60; self.healthBarFill.y = -enemyGraphics.height / 2 - 30; self.addChild(self.healthBarFill); self.setWaveColor = function (waveNum) { self.waveNumber = waveNum; var colors = [0xffffff, 0xff6b6b, 0x4ecdc4, 0x45b7d1, 0x96ceb4, 0xffeaa7, 0xdda0dd, 0xff7675, 0x74b9ff, 0x00b894]; var colorIndex = (waveNum - 1) % colors.length; enemyGraphics.tint = colors[colorIndex]; }; self.updateHealthBar = function () { var healthPercent = self.health / self.maxHealth; self.healthBarFill.scaleX = 0.8 * healthPercent; if (healthPercent > 0.6) { self.healthBarFill.tint = 0x27ae60; // Green } else if (healthPercent > 0.3) { self.healthBarFill.tint = 0xf39c12; // Orange } else { self.healthBarFill.tint = 0xe74c3c; // Red } }; self.takeDamage = function (damage) { self.health -= damage; self.updateHealthBar(); // Get current wave color for restore var colors = [0xffffff, 0xff6b6b, 0x4ecdc4, 0x45b7d1, 0x96ceb4, 0xffeaa7, 0xdda0dd, 0xff7675, 0x74b9ff, 0x00b894]; var colorIndex = (self.waveNumber - 1) % colors.length; var originalColor = colors[colorIndex]; // Flash red when taking damage tween(enemyGraphics, { tint: 0xff0000 }, { duration: 100, onFinish: function onFinish() { tween(enemyGraphics, { tint: originalColor }, { duration: 100 }); } }); if (self.health <= 0) { self.die(); } }; self.die = function () { gold += self.goldReward; crystals += self.isBoss ? 5 : 1; updateGoldDisplay(); updateCrystalsDisplay(); if (storage.soundEnabled !== false) LK.getSound('enemyDeath').play(); // Death animation tween(self, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 300, onFinish: function onFinish() { var index = enemies.indexOf(self); if (index > -1) { enemies.splice(index, 1); } self.destroy(); spawnNextEnemy(); } }); }; return self; }); var Boss = Enemy.expand(function () { var self = Enemy.call(this); // Replace graphics with boss asset self.removeChildren(); var bossGraphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 500; self.health = self.maxHealth; self.goldReward = 200; self.isBoss = true; // Re-add health bar for boss self.healthBarBg = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 0.4 }); self.healthBarBg.tint = 0x333333; self.healthBarBg.y = -bossGraphics.height / 2 - 40; self.addChild(self.healthBarBg); self.healthBarFill = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 0.4 }); self.healthBarFill.tint = 0x8e44ad; self.healthBarFill.y = -bossGraphics.height / 2 - 40; self.addChild(self.healthBarFill); var originalSetWaveColor = self.setWaveColor; self.setWaveColor = function (waveNum) { self.waveNumber = waveNum; // Bosses always stay purple but get darker with higher waves var darkness = Math.min(waveNum * 0.1, 0.7); var baseColor = 0x8e44ad; var r = baseColor >> 16 & 0xFF; var g = baseColor >> 8 & 0xFF; var b = baseColor & 0xFF; r = Math.floor(r * (1 - darkness)); g = Math.floor(g * (1 - darkness)); b = Math.floor(b * (1 - darkness)); bossGraphics.tint = r << 16 | g << 8 | b; }; return self; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.level = 1; self.damage = 10; self.attackSpeed = 1000; // milliseconds between attacks self.lastAttackTime = 0; self.cost = 100; self.type = 'DPS'; // DPS, Support, Tank self.attack = function () { if (currentEnemy && LK.ticks * 16.67 - self.lastAttackTime >= self.attackSpeed) { var projectile = new HeroProjectile(); projectile.x = self.x; projectile.y = self.y; projectile.targetX = currentEnemy.x; projectile.targetY = currentEnemy.y; projectile.damage = self.damage; projectiles.push(projectile); game.addChild(projectile); if (storage.soundEnabled !== false) LK.getSound('attack').play(); self.lastAttackTime = LK.ticks * 16.67; } }; self.upgrade = function () { var upgradeCost = Math.floor(self.cost * Math.pow(1.15, self.level - 1)); if (gold >= upgradeCost) { gold -= upgradeCost; self.level++; self.damage = Math.floor(self.damage * 1.2); self.cost = upgradeCost; storage.heroLevel = self.level; updateGoldDisplay(); } }; self.upgradeAttackSpeed = function () { var upgradeCost = Math.floor(150 * Math.pow(1.2, self.level - 1)); if (gold >= upgradeCost) { gold -= upgradeCost; self.attackSpeed = Math.max(100, Math.floor(self.attackSpeed * 0.9)); // Reduce attack time by 10%, minimum 100ms storage.heroAttackLevel = (storage.heroAttackLevel || 0) + 1; updateGoldDisplay(); } }; self.update = function () { self.attack(); }; return self; }); var HeroProjectile = Container.expand(function () { var self = Container.call(this); var projectileGraphics = self.attachAsset('heroProjectile', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.damage = 10; self.targetX = 0; self.targetY = 0; self.update = function () { var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 10) { // Hit target if (currentEnemy) { currentEnemy.takeDamage(self.damage); } var index = projectiles.indexOf(self); if (index > -1) { projectiles.splice(index, 1); } self.destroy(); } else { // Move towards target self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; return self; }); var SettingsPanel = Container.expand(function () { var self = Container.call(this); // Semi-transparent overlay var overlay = LK.getAsset('settingsPanel', { anchorX: 0.5, anchorY: 0.5, scaleX: 4, scaleY: 4 }); overlay.tint = 0x000000; overlay.alpha = 0.8; overlay.x = 1024; overlay.y = 1366; self.addChild(overlay); // Settings panel background var panelBg = self.attachAsset('settingsPanel', { anchorX: 0.5, anchorY: 0.5 }); panelBg.x = 1024; panelBg.y = 1366; // Title var titleText = new Text2('AYARLAR', { size: 60, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 1066; self.addChild(titleText); // Music toggle var musicToggle = LK.getAsset('toggleButton', { anchorX: 0.5, anchorY: 0.5 }); musicToggle.x = 1174; musicToggle.y = 1200; musicToggle.tint = storage.musicEnabled !== false ? 0x27ae60 : 0xe74c3c; self.addChild(musicToggle); var musicLabel = new Text2('Müzik:', { size: 40, fill: 0xFFFFFF }); musicLabel.anchor.set(0, 0.5); musicLabel.x = 774; musicLabel.y = 1200; self.addChild(musicLabel); var musicText = new Text2(storage.musicEnabled !== false ? 'AÇIK' : 'KAPALI', { size: 30, fill: 0xFFFFFF }); musicText.anchor.set(0.5, 0.5); musicText.x = 1174; musicText.y = 1200; self.addChild(musicText); musicToggle.down = function () { storage.musicEnabled = !storage.musicEnabled; musicToggle.tint = storage.musicEnabled ? 0x27ae60 : 0xe74c3c; musicText.setText(storage.musicEnabled ? 'AÇIK' : 'KAPALI'); if (storage.musicEnabled) { LK.playMusic('battleMusic'); } else { LK.stopMusic(); } }; // Sound effects toggle var soundToggle = LK.getAsset('toggleButton', { anchorX: 0.5, anchorY: 0.5 }); soundToggle.x = 1174; soundToggle.y = 1300; soundToggle.tint = storage.soundEnabled !== false ? 0x27ae60 : 0xe74c3c; self.addChild(soundToggle); var soundLabel = new Text2('Efektler:', { size: 40, fill: 0xFFFFFF }); soundLabel.anchor.set(0, 0.5); soundLabel.x = 774; soundLabel.y = 1300; self.addChild(soundLabel); var soundText = new Text2(storage.soundEnabled !== false ? 'AÇIK' : 'KAPALI', { size: 30, fill: 0xFFFFFF }); soundText.anchor.set(0.5, 0.5); soundText.x = 1174; soundText.y = 1300; self.addChild(soundText); soundToggle.down = function () { storage.soundEnabled = !storage.soundEnabled; soundToggle.tint = storage.soundEnabled ? 0x27ae60 : 0xe74c3c; soundText.setText(storage.soundEnabled ? 'AÇIK' : 'KAPALI'); }; // Language toggle var langToggle = LK.getAsset('toggleButton', { anchorX: 0.5, anchorY: 0.5 }); langToggle.x = 1174; langToggle.y = 1400; langToggle.tint = 0x3498db; self.addChild(langToggle); var langLabel = new Text2('Dil:', { size: 40, fill: 0xFFFFFF }); langLabel.anchor.set(0, 0.5); langLabel.x = 774; langLabel.y = 1400; self.addChild(langLabel); var langText = new Text2(storage.language || 'TR', { size: 30, fill: 0xFFFFFF }); langText.anchor.set(0.5, 0.5); langText.x = 1174; langText.y = 1400; self.addChild(langText); langToggle.down = function () { storage.language = storage.language === 'EN' ? 'TR' : 'EN'; langText.setText(storage.language); self.updateLanguage(); }; // Reset game button var resetBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); resetBtn.x = 1024; resetBtn.y = 1500; resetBtn.tint = 0xe74c3c; self.addChild(resetBtn); var resetText = new Text2('OYUNU SIFIRLA', { size: 36, fill: 0xFFFFFF }); resetText.anchor.set(0.5, 0.5); resetText.x = 1024; resetText.y = 1500; self.addChild(resetText); resetBtn.down = function () { // Reset all game state and upgrades storage.gold = 500; storage.crystals = 10; storage.wave = 1; storage.currentDPS = 0; delete storage.heroLevel; delete storage.heroAttackLevel; delete storage.prestigeMultiplier; LK.showGameOver(); }; // Close button var closeBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); closeBtn.x = 1024; closeBtn.y = 1600; closeBtn.tint = 0x95a5a6; self.addChild(closeBtn); var closeText = new Text2('KAPAT', { size: 36, fill: 0xFFFFFF }); closeText.anchor.set(0.5, 0.5); closeText.x = 1024; closeText.y = 1600; self.addChild(closeText); closeBtn.down = function () { self.hide(); }; self.updateLanguage = function () { var isEn = storage.language === 'EN'; titleText.setText(isEn ? 'SETTINGS' : 'AYARLAR'); musicLabel.setText(isEn ? 'Music:' : 'Müzik:'); soundLabel.setText(isEn ? 'Effects:' : 'Efektler:'); langLabel.setText(isEn ? 'Language:' : 'Dil:'); musicText.setText(storage.musicEnabled !== false ? isEn ? 'ON' : 'AÇIK' : isEn ? 'OFF' : 'KAPALI'); soundText.setText(storage.soundEnabled !== false ? isEn ? 'ON' : 'AÇIK' : isEn ? 'OFF' : 'KAPALI'); resetText.setText(isEn ? 'RESET GAME' : 'OYUNU SIFIRLA'); closeText.setText(isEn ? 'CLOSE' : 'KAPAT'); }; self.show = function () { self.alpha = 1; self.visible = true; game.isPaused = true; }; self.hide = function () { self.alpha = 0; self.visible = false; game.isPaused = false; }; // Start hidden self.hide(); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ // Game state variables var gold = storage.gold || 500; var crystals = storage.crystals || 10; var wave = storage.wave || 1; var currentDPS = storage.currentDPS || 0; var prestigeMultiplier = storage.prestigeMultiplier || 1; var heroes = []; var enemies = []; var projectiles = []; var currentEnemy = null; // UI elements var goldText = new Text2('Gold: ' + gold, { size: 40, fill: 0xFFD700 }); goldText.anchor.set(0, 0); goldText.x = 120; goldText.y = 50; LK.gui.topLeft.addChild(goldText); var crystalsText = new Text2('Crystals: ' + crystals, { size: 40, fill: 0x9B59B6 }); crystalsText.anchor.set(0, 0); crystalsText.x = 120; crystalsText.y = 100; LK.gui.topLeft.addChild(crystalsText); var waveText = new Text2('Wave: ' + wave, { size: 50, fill: 0xFFFFFF }); waveText.anchor.set(0.5, 0); waveText.x = 0; waveText.y = 50; LK.gui.top.addChild(waveText); var dpsText = new Text2('DPS: ' + currentDPS, { size: 40, fill: 0xE74C3C }); dpsText.anchor.set(1, 0); dpsText.x = 0; dpsText.y = 50; LK.gui.topRight.addChild(dpsText); // Damage upgrade button var upgradeBtn = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); upgradeBtn.x = -110; upgradeBtn.y = -100; LK.gui.bottom.addChild(upgradeBtn); var upgradeBtnText = new Text2('Upgrade Damage\n100 Gold', { size: 22, fill: 0xFFFFFF }); upgradeBtnText.anchor.set(0.5, 0.5); upgradeBtn.addChild(upgradeBtnText); upgradeBtn.down = function () { if (heroes.length > 0) { var upgradeCost = Math.floor(heroes[0].cost * Math.pow(1.15, heroes[0].level - 1)); if (gold >= upgradeCost) { gold -= upgradeCost; heroes[0].level++; heroes[0].damage = Math.floor(heroes[0].damage * 1.2); heroes[0].cost = upgradeCost; storage.heroLevel = heroes[0].level; updateGoldDisplay(); } updateUpgradeButton(); } }; // Attack speed upgrade button var attackSpeedBtn = LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); attackSpeedBtn.x = 110; attackSpeedBtn.y = -100; LK.gui.bottom.addChild(attackSpeedBtn); var attackSpeedBtnText = new Text2('Upgrade Speed\n150 Gold', { size: 22, fill: 0xFFFFFF }); attackSpeedBtnText.anchor.set(0.5, 0.5); attackSpeedBtn.addChild(attackSpeedBtnText); attackSpeedBtn.down = function () { if (heroes.length > 0) { var upgradeCost = Math.floor(150 * Math.pow(1.2, heroes[0].level - 1)); if (gold >= upgradeCost) { gold -= upgradeCost; heroes[0].attackSpeed = Math.max(100, Math.floor(heroes[0].attackSpeed * 0.9)); storage.heroAttackLevel = (storage.heroAttackLevel || 0) + 1; updateGoldDisplay(); } updateAttackSpeedButton(); } }; // Summon button removed - hero çağır butonunu kaldır // Prestige button var prestigeBtn = LK.getAsset('summonButton', { anchorX: 0.5, anchorY: 0.5 }); prestigeBtn.x = 90; prestigeBtn.y = -40; LK.gui.bottom.addChild(prestigeBtn); var prestigeBtnText = new Text2('Prestige\n1000 Crystals', { size: 24, fill: 0xFFFFFF }); prestigeBtnText.anchor.set(0.5, 0.5); prestigeBtn.addChild(prestigeBtnText); prestigeBtn.down = function () { if (crystals >= 1000) { crystals -= 1000; doPrestige(); updateCrystalsDisplay(); } }; // Admin mode icon in bottom left var adminIcon = LK.getAsset('settingsIcon', { anchorX: 0.5, anchorY: 0.5 }); adminIcon.x = 50; adminIcon.y = -50; adminIcon.tint = 0xff6b6b; LK.gui.bottomLeft.addChild(adminIcon); var adminText = new Text2('⚡', { size: 50, fill: 0xFFFFFF }); adminText.anchor.set(0.5, 0.5); adminIcon.addChild(adminText); // Admin panel var adminPanel = new Container(); // Semi-transparent overlay var adminOverlay = LK.getAsset('settingsPanel', { anchorX: 0.5, anchorY: 0.5, scaleX: 4, scaleY: 4 }); adminOverlay.tint = 0x000000; adminOverlay.alpha = 0.8; adminOverlay.x = 1024; adminOverlay.y = 1366; adminPanel.addChild(adminOverlay); // Admin panel background var adminPanelBg = LK.getAsset('settingsPanel', { anchorX: 0.5, anchorY: 0.5 }); adminPanelBg.x = 1024; adminPanelBg.y = 1366; adminPanel.addChild(adminPanelBg); // Title var adminTitleText = new Text2('ADMIN MODU', { size: 60, fill: 0xff6b6b }); adminTitleText.anchor.set(0.5, 0.5); adminTitleText.x = 1024; adminTitleText.y = 1066; adminPanel.addChild(adminTitleText); // Add 1000 Gold button var addGoldBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); addGoldBtn.x = 1024; addGoldBtn.y = 1200; addGoldBtn.tint = 0xf39c12; adminPanel.addChild(addGoldBtn); var addGoldText = new Text2('+1000 ALTIN', { size: 36, fill: 0xFFFFFF }); addGoldText.anchor.set(0.5, 0.5); addGoldText.x = 1024; addGoldText.y = 1200; adminPanel.addChild(addGoldText); addGoldBtn.down = function () { gold += 1000; updateGoldDisplay(); }; // Add 100 Crystals button var addCrystalsBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); addCrystalsBtn.x = 1024; addCrystalsBtn.y = 1280; addCrystalsBtn.tint = 0x9b59b6; adminPanel.addChild(addCrystalsBtn); var addCrystalsText = new Text2('+100 KRİSTAL', { size: 36, fill: 0xFFFFFF }); addCrystalsText.anchor.set(0.5, 0.5); addCrystalsText.x = 1024; addCrystalsText.y = 1280; adminPanel.addChild(addCrystalsText); addCrystalsBtn.down = function () { crystals += 100; updateCrystalsDisplay(); }; // Skip to next wave button var skipWaveBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); skipWaveBtn.x = 1024; skipWaveBtn.y = 1360; skipWaveBtn.tint = 0x3498db; adminPanel.addChild(skipWaveBtn); var skipWaveText = new Text2('SONRAKİ DALGA', { size: 36, fill: 0xFFFFFF }); skipWaveText.anchor.set(0.5, 0.5); skipWaveText.x = 1024; skipWaveText.y = 1360; adminPanel.addChild(skipWaveText); skipWaveBtn.down = function () { if (currentEnemy) { currentEnemy.die(); } }; // Kill all enemies button var killAllBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); killAllBtn.x = 1024; killAllBtn.y = 1440; killAllBtn.tint = 0xe74c3c; adminPanel.addChild(killAllBtn); var killAllText = new Text2('TÜM DÜŞMANLARI ÖLDür', { size: 30, fill: 0xFFFFFF }); killAllText.anchor.set(0.5, 0.5); killAllText.x = 1024; killAllText.y = 1440; adminPanel.addChild(killAllText); killAllBtn.down = function () { for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].die(); } }; // Max upgrade hero button var maxUpgradeBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); maxUpgradeBtn.x = 1024; maxUpgradeBtn.y = 1520; maxUpgradeBtn.tint = 0x27ae60; adminPanel.addChild(maxUpgradeBtn); var maxUpgradeText = new Text2('KAHRAMANI MAX YAP', { size: 30, fill: 0xFFFFFF }); maxUpgradeText.anchor.set(0.5, 0.5); maxUpgradeText.x = 1024; maxUpgradeText.y = 1520; adminPanel.addChild(maxUpgradeText); maxUpgradeBtn.down = function () { if (heroes.length > 0) { for (var i = 0; i < 10; i++) { heroes[0].upgrade(); heroes[0].upgradeAttackSpeed(); } updateUpgradeButton(); updateAttackSpeedButton(); } }; // Close admin panel button var closeAdminBtn = LK.getAsset('settingsButton', { anchorX: 0.5, anchorY: 0.5 }); closeAdminBtn.x = 1024; closeAdminBtn.y = 1600; closeAdminBtn.tint = 0x95a5a6; adminPanel.addChild(closeAdminBtn); var closeAdminText = new Text2('KAPAT', { size: 36, fill: 0xFFFFFF }); closeAdminText.anchor.set(0.5, 0.5); closeAdminText.x = 1024; closeAdminText.y = 1600; adminPanel.addChild(closeAdminText); closeAdminBtn.down = function () { adminPanel.alpha = 0; adminPanel.visible = false; game.isPaused = false; }; // Start admin panel hidden adminPanel.alpha = 0; adminPanel.visible = false; game.addChild(adminPanel); adminIcon.down = function () { adminPanel.alpha = 1; adminPanel.visible = true; game.isPaused = true; }; // Settings icon in bottom right var settingsIcon = LK.getAsset('settingsIcon', { anchorX: 0.5, anchorY: 0.5 }); settingsIcon.x = -50; settingsIcon.y = -50; LK.gui.bottomRight.addChild(settingsIcon); var settingsText = new Text2('⚙', { size: 50, fill: 0xFFFFFF }); settingsText.anchor.set(0.5, 0.5); settingsIcon.addChild(settingsText); // Settings panel var settingsPanel = new SettingsPanel(); game.addChild(settingsPanel); settingsIcon.down = function () { settingsPanel.show(); }; // Game functions function updateGoldDisplay() { goldText.setText('Gold: ' + gold); storage.gold = gold; } function updateCrystalsDisplay() { crystalsText.setText('Crystals: ' + crystals); storage.crystals = crystals; } function updateWaveDisplay() { waveText.setText('Wave: ' + wave); storage.wave = wave; } function updateDPSDisplay() { var totalDPS = 0; for (var i = 0; i < heroes.length; i++) { totalDPS += Math.floor(heroes[i].damage * 1000 / heroes[i].attackSpeed); } currentDPS = totalDPS; storage.currentDPS = currentDPS; dpsText.setText('DPS: ' + totalDPS); } function updateUpgradeButton() { if (heroes.length > 0) { var cost = Math.floor(heroes[0].cost * Math.pow(1.15, heroes[0].level - 1)); upgradeBtnText.setText('Upgrade Damage\n' + cost + ' Gold'); } } function updateAttackSpeedButton() { if (heroes.length > 0) { var cost = Math.floor(150 * Math.pow(1.2, heroes[0].level - 1)); attackSpeedBtnText.setText('Upgrade Speed\n' + cost + ' Gold'); } } function summonHero() { var hero = new Hero(); hero.x = 300 + heroes.length * 100; hero.y = 1500; // Apply stored upgrade levels if (storage.heroLevel) { hero.level = storage.heroLevel; hero.damage = Math.floor(10 * Math.pow(1.2, hero.level - 1) * prestigeMultiplier); } if (storage.heroAttackLevel) { hero.attackSpeed = Math.max(100, Math.floor(1000 * Math.pow(0.9, storage.heroAttackLevel) / prestigeMultiplier)); } // Apply prestige multiplier to new heroes hero.damage = Math.floor(hero.damage * prestigeMultiplier); hero.attackSpeed = Math.max(100, Math.floor(hero.attackSpeed / prestigeMultiplier)); heroes.push(hero); game.addChild(hero); } function doPrestige() { // Increase prestige multiplier by 1.5x prestigeMultiplier *= 1.5; storage.prestigeMultiplier = prestigeMultiplier; // Reset all game state gold = 500; crystals = 10; wave = 1; currentDPS = 0; // Clear all game objects for (var i = heroes.length - 1; i >= 0; i--) { heroes[i].destroy(); } heroes = []; for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].destroy(); } enemies = []; currentEnemy = null; for (var i = projectiles.length - 1; i >= 0; i--) { projectiles[i].destroy(); } projectiles = []; // Clear storage upgrades (reset upgrades on prestige) delete storage.heroLevel; delete storage.heroAttackLevel; // Update storage with reset values storage.gold = gold; storage.crystals = crystals; storage.wave = wave; storage.currentDPS = currentDPS; // Update displays updateGoldDisplay(); updateCrystalsDisplay(); updateWaveDisplay(); updateDPSDisplay(); // Restart the game with prestige bonus summonHero(); spawnEnemy(); } function spawnEnemy() { // Don't spawn if there are already enemies alive if (enemies.length > 0 || currentEnemy) { return; } var enemy; if (wave % 10 === 0) { // Boss wave - only spawn boss enemy = new Boss(); enemy.maxHealth = Math.floor(500 * Math.pow(1.5, Math.floor(wave / 10))); } else { // Regular wave - spawn single titan enemy = new Enemy(); enemy.maxHealth = Math.floor(100 * Math.pow(1.2, wave)); } enemy.health = enemy.maxHealth; enemy.goldReward = Math.floor(enemy.goldReward * Math.pow(1.1, wave)); enemy.setWaveColor(wave); enemy.updateHealthBar(); enemy.x = 1500; enemy.y = 800; enemies.push(enemy); game.addChild(enemy); currentEnemy = enemy; } function spawnNextEnemy() { // Clear current enemy reference currentEnemy = null; // Always spawn next enemy after a small delay LK.setTimeout(function () { // Check if we should proceed to next wave if (enemies.length === 0) { wave++; updateWaveDisplay(); } spawnEnemy(); }, 1000); } // Initialize first hero and enemy summonHero(); spawnEnemy(); // Start background music if (storage.musicEnabled !== false) { LK.playMusic('battleMusic'); } // Main game loop game.update = function () { // Skip update if game is paused if (game.isPaused) return; // Update displays updateDPSDisplay(); updateUpgradeButton(); updateAttackSpeedButton(); // Clean up destroyed projectiles for (var i = projectiles.length - 1; i >= 0; i--) { if (!projectiles[i].parent) { projectiles.splice(i, 1); } } // Clean up destroyed enemies for (var i = enemies.length - 1; i >= 0; i--) { if (!enemies[i].parent) { if (enemies[i] === currentEnemy) { currentEnemy = null; } enemies.splice(i, 1); } } // Set current enemy to first alive enemy if none is set if (!currentEnemy && enemies.length > 0) { currentEnemy = enemies[0]; } };
===================================================================
--- original.js
+++ change.js
@@ -501,9 +501,17 @@
upgradeBtnText.anchor.set(0.5, 0.5);
upgradeBtn.addChild(upgradeBtnText);
upgradeBtn.down = function () {
if (heroes.length > 0) {
- heroes[0].upgrade();
+ var upgradeCost = Math.floor(heroes[0].cost * Math.pow(1.15, heroes[0].level - 1));
+ if (gold >= upgradeCost) {
+ gold -= upgradeCost;
+ heroes[0].level++;
+ heroes[0].damage = Math.floor(heroes[0].damage * 1.2);
+ heroes[0].cost = upgradeCost;
+ storage.heroLevel = heroes[0].level;
+ updateGoldDisplay();
+ }
updateUpgradeButton();
}
};
// Attack speed upgrade button
@@ -521,9 +529,15 @@
attackSpeedBtnText.anchor.set(0.5, 0.5);
attackSpeedBtn.addChild(attackSpeedBtnText);
attackSpeedBtn.down = function () {
if (heroes.length > 0) {
- heroes[0].upgradeAttackSpeed();
+ var upgradeCost = Math.floor(150 * Math.pow(1.2, heroes[0].level - 1));
+ if (gold >= upgradeCost) {
+ gold -= upgradeCost;
+ heroes[0].attackSpeed = Math.max(100, Math.floor(heroes[0].attackSpeed * 0.9));
+ storage.heroAttackLevel = (storage.heroAttackLevel || 0) + 1;
+ updateGoldDisplay();
+ }
updateAttackSpeedButton();
}
};
// Summon button removed - hero çağır butonunu kaldır
Büyücü. In-Game asset. 2d. High contrast. No shadows
Titan enemy. In-Game asset. 2d. High contrast. No shadows
Boss Titan. In-Game asset. 2d. High contrast. No shadows
GOLD. In-Game asset. 2d. High contrast. No shadows
doğa. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
fireball. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat