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) {
var wasAtFullHealth = self.health === self.maxHealth;
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) {
// Check if this was a one-shot kill (enemy was at full health before this damage)
if (wasAtFullHealth) {
self.showHeadshotEffect();
}
self.die();
}
};
self.showHeadshotEffect = function () {
// Create headshot text
var headshotText = new Text2('HEADSHOT!', {
size: 80,
fill: 0xFFD700
});
headshotText.anchor.set(0.5, 0.5);
headshotText.x = self.x;
headshotText.y = self.y - 100;
headshotText.alpha = 1;
game.addChild(headshotText);
// Create pulsing scale effect
tween(headshotText, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(headshotText, {
scaleX: 1,
scaleY: 1,
y: headshotText.y - 80,
alpha: 0
}, {
duration: 800,
easing: tween.easeIn,
onFinish: function onFinish() {
headshotText.destroy();
}
});
}
});
// Create explosion effect with scaling circle
var explosionEffect = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.1,
scaleY: 0.1
});
explosionEffect.x = self.x;
explosionEffect.y = self.y;
explosionEffect.tint = 0xFFD700;
explosionEffect.alpha = 0.8;
game.addChild(explosionEffect);
// Animate explosion expanding and fading
tween(explosionEffect, {
scaleX: 3,
scaleY: 3,
alpha: 0
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
explosionEffect.destroy();
}
});
};
self.die = function () {
gold += self.goldReward * 2; // Increase gold reward by 2x
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 = 10000;
self.health = self.maxHealth;
self.goldReward = 500;
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;
};
// Override showHeadshotEffect for boss with more dramatic effect
self.showHeadshotEffect = function () {
// Create headshot text for boss (bigger and more dramatic)
var headshotText = new Text2('BOSS HEADSHOT!', {
size: 100,
fill: 0xFF0000
});
headshotText.anchor.set(0.5, 0.5);
headshotText.x = self.x;
headshotText.y = self.y - 150;
headshotText.alpha = 1;
game.addChild(headshotText);
// Create pulsing scale effect
tween(headshotText, {
scaleX: 2,
scaleY: 2
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(headshotText, {
scaleX: 1,
scaleY: 1,
y: headshotText.y - 100,
alpha: 0
}, {
duration: 1000,
easing: tween.easeIn,
onFinish: function onFinish() {
headshotText.destroy();
}
});
}
});
// Create larger explosion effect for boss
var explosionEffect = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.1,
scaleY: 0.1
});
explosionEffect.x = self.x;
explosionEffect.y = self.y;
explosionEffect.tint = 0xFF0000;
explosionEffect.alpha = 1;
game.addChild(explosionEffect);
// Animate boss explosion expanding and fading
tween(explosionEffect, {
scaleX: 5,
scaleY: 5,
alpha: 0
}, {
duration: 700,
easing: tween.easeOut,
onFinish: function onFinish() {
explosionEffect.destroy();
}
});
};
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 / gameSpeed) {
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.5);
self.cost = upgradeCost;
storage.heroLevel = self.level;
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 * gameSpeed;
self.y += dy / distance * self.speed * gameSpeed;
}
};
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.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;
// Bring settings panel to front to ensure it's on top
if (self.parent) {
self.parent.setChildIndex(self, self.parent.children.length - 1);
}
// Also ensure overlay is on top
if (overlay.parent) {
overlay.parent.setChildIndex(overlay, overlay.parent.children.length - 1);
}
// And ensure panel background is on top
if (panelBg.parent) {
panelBg.parent.setChildIndex(panelBg, panelBg.parent.children.length - 1);
}
// Bring all text and buttons to front to ensure they're above the panel
if (titleText.parent) {
titleText.parent.setChildIndex(titleText, titleText.parent.children.length - 1);
}
if (musicToggle.parent) {
musicToggle.parent.setChildIndex(musicToggle, musicToggle.parent.children.length - 1);
}
if (musicLabel.parent) {
musicLabel.parent.setChildIndex(musicLabel, musicLabel.parent.children.length - 1);
}
if (musicText.parent) {
musicText.parent.setChildIndex(musicText, musicText.parent.children.length - 1);
}
if (soundToggle.parent) {
soundToggle.parent.setChildIndex(soundToggle, soundToggle.parent.children.length - 1);
}
if (soundLabel.parent) {
soundLabel.parent.setChildIndex(soundLabel, soundLabel.parent.children.length - 1);
}
if (soundText.parent) {
soundText.parent.setChildIndex(soundText, soundText.parent.children.length - 1);
}
if (langToggle.parent) {
langToggle.parent.setChildIndex(langToggle, langToggle.parent.children.length - 1);
}
if (langLabel.parent) {
langLabel.parent.setChildIndex(langLabel, langLabel.parent.children.length - 1);
}
if (langText.parent) {
langText.parent.setChildIndex(langText, langText.parent.children.length - 1);
}
if (resetBtn.parent) {
resetBtn.parent.setChildIndex(resetBtn, resetBtn.parent.children.length - 1);
}
if (resetText.parent) {
resetText.parent.setChildIndex(resetText, resetText.parent.children.length - 1);
}
if (closeBtn.parent) {
closeBtn.parent.setChildIndex(closeBtn, closeBtn.parent.children.length - 1);
}
if (closeText.parent) {
closeText.parent.setChildIndex(closeText, closeText.parent.children.length - 1);
}
};
self.hide = function () {
self.alpha = 0;
self.visible = false;
game.isPaused = false;
};
// Start hidden
self.hide();
return self;
});
var TutorialPanel = 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.9;
overlay.x = 1024;
overlay.y = 1366;
self.addChild(overlay);
// Tutorial panel background
var panelBg = self.attachAsset('settingsPanel', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.3
});
panelBg.x = 1024;
panelBg.y = 1366;
// Title
var titleText = new Text2('OYUNU ÖĞRENİN', {
size: 60,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 1000;
self.addChild(titleText);
// Tutorial content
var tutorialText = new Text2('• Ekrana dokunarak altın kazanın\n• Altınla kahramanınızı güçlendirin\n• Dalgaları geçip kristal toplayın\n• 1000 kristalle prestij yapın\n• Bossları yenip ilerleyin!', {
size: 36,
fill: 0xFFFFFF
});
tutorialText.anchor.set(0.5, 0.5);
tutorialText.x = 1024;
tutorialText.y = 1300;
self.addChild(tutorialText);
// Gold tap hint
var tapHintText = new Text2('💰 EKRANA DOKUNUN = ALTIN 💰', {
size: 40,
fill: 0xFFD700
});
tapHintText.anchor.set(0.5, 0.5);
tapHintText.x = 1024;
tapHintText.y = 1500;
self.addChild(tapHintText);
// Close button (X)
var closeBtn = LK.getAsset('settingsIcon', {
anchorX: 0.5,
anchorY: 0.5
});
closeBtn.x = 1300;
closeBtn.y = 900;
closeBtn.tint = 0xe74c3c;
self.addChild(closeBtn);
var closeText = new Text2('✕', {
size: 50,
fill: 0xFFFFFF
});
closeText.anchor.set(0.5, 0.5);
closeBtn.addChild(closeText);
closeBtn.down = function () {
self.hide();
};
self.show = function () {
self.alpha = 1;
self.visible = true;
game.isPaused = true;
};
self.hide = function () {
self.alpha = 0;
self.visible = false;
game.isPaused = false;
// Mark tutorial as seen
storage.tutorialSeen = true;
};
// Start visible
self.alpha = 1;
self.visible = true;
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 = -40;
LK.gui.bottom.addChild(upgradeBtn);
var upgradeBtnText = new Text2('Upgrade Damage\n100 Gold', {
size: 22,
fill: 0x000000
});
upgradeBtnText.anchor.set(0.5, 0.5);
upgradeBtn.addChild(upgradeBtnText);
upgradeBtn.down = function () {
if (heroes.length > 0) {
var baseCost = 100; // Use fixed base cost
var upgradeCost = Math.floor(baseCost * Math.pow(1.15, heroes[0].level));
if (gold >= upgradeCost) {
gold -= upgradeCost;
heroes[0].level++;
heroes[0].damage = Math.floor(heroes[0].damage * 1.5 * 0.9);
storage.heroLevel = heroes[0].level;
updateGoldDisplay();
}
updateUpgradeButton();
}
};
// 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: 0x000000
});
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: 0x000000
});
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: 0x000000
});
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: 0x000000
});
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: 0x000000
});
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: 0x000000
});
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: 0x000000
});
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();
}
updateUpgradeButton();
}
};
// 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: 0x000000
});
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;
};
// Game speed control
var gameSpeed = storage.gameSpeed || 1;
var gameSpeedMultipliers = [1, 2];
var gameSpeedButton = LK.getAsset('toggleButton', {
anchorX: 0.5,
anchorY: 0.5
});
gameSpeedButton.x = -50;
gameSpeedButton.y = -120;
LK.gui.bottomRight.addChild(gameSpeedButton);
var gameSpeedText = new Text2(gameSpeed + 'x', {
size: 30,
fill: 0x000000
});
gameSpeedText.anchor.set(0.5, 0.5);
gameSpeedButton.addChild(gameSpeedText);
gameSpeedButton.down = function () {
var currentIndex = gameSpeedMultipliers.indexOf(gameSpeed);
var nextIndex = (currentIndex + 1) % gameSpeedMultipliers.length;
gameSpeed = gameSpeedMultipliers[nextIndex];
storage.gameSpeed = gameSpeed;
gameSpeedText.setText(gameSpeed + 'x');
};
// 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: 0x000000
});
settingsText.anchor.set(0.5, 0.5);
settingsIcon.addChild(settingsText);
// Settings panel
var settingsPanel = new SettingsPanel();
game.addChild(settingsPanel);
settingsIcon.down = function () {
settingsPanel.show();
};
// Tutorial panel - show only once for new players
var tutorialPanel = new TutorialPanel();
game.addChild(tutorialPanel);
// Check if tutorial should be shown
if (!storage.tutorialSeen) {
tutorialPanel.show();
game.isPaused = true;
} else {
tutorialPanel.hide();
}
// 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 baseCost = 100; // Use fixed base cost instead of hero.cost
var cost = Math.floor(baseCost * Math.pow(1.15, heroes[0].level));
upgradeBtnText.setText('Upgrade Damage\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.5, hero.level - 1) * prestigeMultiplier);
}
// Apply prestige multiplier to new heroes
hero.damage = Math.floor(hero.damage * 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;
// 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(10.0, 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 / gameSpeed);
}
// Initialize first hero and enemy
summonHero();
spawnEnemy();
// Start background music
if (storage.musicEnabled !== false) {
LK.playMusic('battleMusic');
}
// Screen tap handler for gold generation
game.down = function (x, y, obj) {
// Only give gold if game is not paused
if (!game.isPaused) {
var tapGold = Math.floor((10 + wave * 5) * prestigeMultiplier);
gold += tapGold;
updateGoldDisplay();
// Create gold icon animation
var goldIcon = LK.getAsset('goldIcon', {
anchorX: 0.5,
anchorY: 0.5
});
goldIcon.x = x;
goldIcon.y = y;
goldIcon.alpha = 1;
game.addChild(goldIcon);
// Animate gold icon moving up and fading out
tween(goldIcon, {
y: y - 100,
alpha: 0
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
goldIcon.destroy();
}
});
}
};
// Main game loop
game.update = function () {
// Skip update if game is paused
if (game.isPaused) {
return;
}
// Update displays
updateDPSDisplay();
updateUpgradeButton();
// 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
@@ -83,8 +83,66 @@
}
self.die();
}
};
+ self.showHeadshotEffect = function () {
+ // Create headshot text
+ var headshotText = new Text2('HEADSHOT!', {
+ size: 80,
+ fill: 0xFFD700
+ });
+ headshotText.anchor.set(0.5, 0.5);
+ headshotText.x = self.x;
+ headshotText.y = self.y - 100;
+ headshotText.alpha = 1;
+ game.addChild(headshotText);
+ // Create pulsing scale effect
+ tween(headshotText, {
+ scaleX: 1.5,
+ scaleY: 1.5
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(headshotText, {
+ scaleX: 1,
+ scaleY: 1,
+ y: headshotText.y - 80,
+ alpha: 0
+ }, {
+ duration: 800,
+ easing: tween.easeIn,
+ onFinish: function onFinish() {
+ headshotText.destroy();
+ }
+ });
+ }
+ });
+ // Create explosion effect with scaling circle
+ var explosionEffect = LK.getAsset('centerCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 0.1,
+ scaleY: 0.1
+ });
+ explosionEffect.x = self.x;
+ explosionEffect.y = self.y;
+ explosionEffect.tint = 0xFFD700;
+ explosionEffect.alpha = 0.8;
+ game.addChild(explosionEffect);
+ // Animate explosion expanding and fading
+ tween(explosionEffect, {
+ scaleX: 3,
+ scaleY: 3,
+ alpha: 0
+ }, {
+ duration: 500,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ explosionEffect.destroy();
+ }
+ });
+ };
self.die = function () {
gold += self.goldReward * 2; // Increase gold reward by 2x
crystals += self.isBoss ? 5 : 1;
updateGoldDisplay();
@@ -107,66 +165,8 @@
self.destroy();
spawnNextEnemy();
}
});
- self.showHeadshotEffect = function () {
- // Create headshot text
- var headshotText = new Text2('HEADSHOT!', {
- size: 80,
- fill: 0xFFD700
- });
- headshotText.anchor.set(0.5, 0.5);
- headshotText.x = self.x;
- headshotText.y = self.y - 100;
- headshotText.alpha = 1;
- game.addChild(headshotText);
- // Create pulsing scale effect
- tween(headshotText, {
- scaleX: 1.5,
- scaleY: 1.5
- }, {
- duration: 200,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(headshotText, {
- scaleX: 1,
- scaleY: 1,
- y: headshotText.y - 80,
- alpha: 0
- }, {
- duration: 800,
- easing: tween.easeIn,
- onFinish: function onFinish() {
- headshotText.destroy();
- }
- });
- }
- });
- // Create explosion effect with scaling circle
- var explosionEffect = LK.getAsset('centerCircle', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 0.1,
- scaleY: 0.1
- });
- explosionEffect.x = self.x;
- explosionEffect.y = self.y;
- explosionEffect.tint = 0xFFD700;
- explosionEffect.alpha = 0.8;
- game.addChild(explosionEffect);
- // Animate explosion expanding and fading
- tween(explosionEffect, {
- scaleX: 3,
- scaleY: 3,
- alpha: 0
- }, {
- duration: 500,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- explosionEffect.destroy();
- }
- });
- };
};
return self;
});
var Boss = Enemy.expand(function () {
@@ -212,67 +212,68 @@
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;
- self.showHeadshotEffect = function () {
- // Create headshot text for boss (bigger and more dramatic)
- var headshotText = new Text2('BOSS HEADSHOT!', {
- size: 100,
- fill: 0xFF0000
- });
- headshotText.anchor.set(0.5, 0.5);
- headshotText.x = self.x;
- headshotText.y = self.y - 150;
- headshotText.alpha = 1;
- game.addChild(headshotText);
- // Create pulsing scale effect
- tween(headshotText, {
- scaleX: 2,
- scaleY: 2
- }, {
- duration: 300,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(headshotText, {
- scaleX: 1,
- scaleY: 1,
- y: headshotText.y - 100,
- alpha: 0
- }, {
- duration: 1000,
- easing: tween.easeIn,
- onFinish: function onFinish() {
- headshotText.destroy();
- }
- });
- }
- });
- // Create larger explosion effect for boss
- var explosionEffect = LK.getAsset('centerCircle', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 0.1,
- scaleY: 0.1
- });
- explosionEffect.x = self.x;
- explosionEffect.y = self.y;
- explosionEffect.tint = 0xFF0000;
- explosionEffect.alpha = 1;
- game.addChild(explosionEffect);
- // Animate boss explosion expanding and fading
- tween(explosionEffect, {
- scaleX: 5,
- scaleY: 5,
- alpha: 0
- }, {
- duration: 700,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- explosionEffect.destroy();
- }
- });
- };
};
+ // Override showHeadshotEffect for boss with more dramatic effect
+ self.showHeadshotEffect = function () {
+ // Create headshot text for boss (bigger and more dramatic)
+ var headshotText = new Text2('BOSS HEADSHOT!', {
+ size: 100,
+ fill: 0xFF0000
+ });
+ headshotText.anchor.set(0.5, 0.5);
+ headshotText.x = self.x;
+ headshotText.y = self.y - 150;
+ headshotText.alpha = 1;
+ game.addChild(headshotText);
+ // Create pulsing scale effect
+ tween(headshotText, {
+ scaleX: 2,
+ scaleY: 2
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(headshotText, {
+ scaleX: 1,
+ scaleY: 1,
+ y: headshotText.y - 100,
+ alpha: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeIn,
+ onFinish: function onFinish() {
+ headshotText.destroy();
+ }
+ });
+ }
+ });
+ // Create larger explosion effect for boss
+ var explosionEffect = LK.getAsset('centerCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 0.1,
+ scaleY: 0.1
+ });
+ explosionEffect.x = self.x;
+ explosionEffect.y = self.y;
+ explosionEffect.tint = 0xFF0000;
+ explosionEffect.alpha = 1;
+ game.addChild(explosionEffect);
+ // Animate boss explosion expanding and fading
+ tween(explosionEffect, {
+ scaleX: 5,
+ scaleY: 5,
+ alpha: 0
+ }, {
+ duration: 700,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ explosionEffect.destroy();
+ }
+ });
+ };
return self;
});
var Hero = Container.expand(function () {
var self = Container.call(this);
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