User prompt
sadece random powerup kalsın ekranda
User prompt
coinle daha fazla şey alınmalı
User prompt
Please fix the bug: 'TypeError: LK.pauseGame is not a function' in or related to this line: 'LK.pauseGame();' Line Number: 1446
User prompt
bu emojiye gelince oyun dursun
User prompt
bir tane mağaza emojisi yap oyuncu o emojiye giderse coin mağazasına gitsin
User prompt
tıklanabilir birşey yap oyunun içine coinle harcama yapılabilen
User prompt
oyun içinde bir yere yap o zaman
User prompt
✅ Add a professional coin shop panel to the game over screen below Play Again bu olmamış
User prompt
oyun bitiş ekranında play again yazıyor onun altına coin shop gibi profesyonel bir yer yapsan olur mu
User prompt
bu toplanan coinler için bissürü şey yapmak lazım sen yapar mısın
User prompt
bu coinle alınabilecek şeyler olması lazım ama farklı yerde lütfen profesyonel birşeyler yap
User prompt
düşmanların üstünde canları yazıyor kalple göstermişin ve sayı var onu büyüt biraz
User prompt
düşmanların can görsellerini biraz büyük yap
User prompt
guı larını büyüt
User prompt
düşmanların can barlarını biraz daha büyük yap
User prompt
oyundaki her şey çok canlı olsun
User prompt
arkaplan asset olarak ekle
User prompt
kaldır onu
User prompt
arka plan rastgele uzay teması olsun
User prompt
düşmanların canları daha belirgin olsun
User prompt
oyuna ekleyebileceğin kadar popup ekle eğlenceli olsun
User prompt
bu coinleri harcayabileceğimiz daha farklı bir yer lazım
User prompt
çoğalma özelliğini kaldır
User prompt
düşmana farklı özellikler ekle ama bu özellikler hız olmasın
User prompt
bu toplanan coinleri harcanan bir yer yap
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // Coin (altın) kutusu var Coin = Container.expand(function () { var self = Container.call(this); var coinGfx = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.radius = coinGfx.width * 0.5; self.update = function () { // Hafifçe döndür coinGfx.rotation += 0.12; }; return self; }); // Düşman karakteri (AI) - Enemy1: Kendini iyileştirme yeteneği var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGfx = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.radius = enemyGfx.width * 0.5; self.type = 1; self.speed = 3 + Math.random() * 2; self.dir = Math.random() * Math.PI * 2; self.shootCooldown = 60 + Math.floor(Math.random() * 60); self.targetX = 0; self.targetY = 0; self.maxHealth = 3 + Math.floor(Math.random() * 2); // 3-4 can self.health = self.maxHealth; // --- YENİ: Kendini iyileştirme özelliği --- self.healCooldown = 180 + Math.floor(Math.random() * 120); // 3-5 saniyede bir self.takeDamage = function (amount) { self.health -= amount; LK.effects.flashObject(self, 0xffff00, 200); if (self.health <= 0) { // Destroy health bar if exists if (self._healthBar) { self._healthBar.destroy(); self._healthBar = null; } // Destroy visible health bar if exists if (self._visHealthBar) { self._visHealthBar.destroy(); self._visHealthBar = null; self._visHealthBarBg = null; self._visHealthBarFg = null; } self.destroy(); // Skor boost varsa 2 puan ver if (player._superScoreBoost && player._scoreBoost > 0) { score += 10; } else if (player._scoreBoost && player._scoreBoost > 0) { score += 2; } else { score++; } updateScoreAndLevel(); if (score > 0 && score % 10 === 0) { increaseDifficulty(); } // Remove from enemies array in main loop self._shouldRemove = true; } }; self.update = function () { if (self._frozen && self._frozen > 0) { // Donmuşsa titret self.x += Math.sin(self._frozen) * 2; self.y += Math.cos(self._frozen) * 2; return; } // --- YENİ: Kendini iyileştirme --- if (self.healCooldown > 0) { self.healCooldown--; } else { if (self.health < self.maxHealth) { self.health++; LK.effects.flashObject(self, 0x00ff00, 200); } self.healCooldown = 180 + Math.floor(Math.random() * 120); } // Basit AI: Oyuncuya doğru hareket et var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 1) { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } // Ateş etme if (self.shootCooldown > 0) { self.shootCooldown--; } else { self.shootCooldown = 90 + Math.floor(Math.random() * 60); spawnEnemyBullet(self.x, self.y, player.x, player.y); } // --- HEALTH BAR (rectangle) --- // Create health bar if not exists if (!self._visHealthBar) { self._visHealthBar = new Container(); self._visHealthBarBg = new Container(); self._visHealthBarFg = new Container(); self._visHealthBar.addChild(self._visHealthBarBg); self._visHealthBar.addChild(self._visHealthBarFg); game.addChild(self._visHealthBar); } if (self._visHealthBar) { // Position above enemy self._visHealthBar.x = self.x; self._visHealthBar.y = self.y - self.radius - 28; // Health percent var hp = Math.max(0, self.health) / self.maxHealth; // Clamp width var fgWidth = Math.max(24, 180 * hp); self._visHealthBarFg.width = fgWidth; // Color: green > yellow > red if (hp > 0.6) { self._visHealthBarFg.tint = 0x00ff00; } else if (hp > 0.3) { self._visHealthBarFg.tint = 0xffe100; } else { self._visHealthBarFg.tint = 0xff4444; } self._visHealthBar.visible = true; } }; return self; }); // Düşman karakteri 2 (dairesel hareket, elips) - Enemy2: Kalkan oluşturma yeteneği var Enemy2 = Container.expand(function () { var self = Container.call(this); var enemyGfx = self.attachAsset('enemy2', { anchorX: 0.5, anchorY: 0.5 }); self.radius = enemyGfx.width * 0.5; self.type = 2; self.angle = Math.random() * Math.PI * 2; // Enemy2: Orbit around a random point in the arena, not the player self.centerX = 200 + Math.random() * 1648; self.centerY = 200 + Math.random() * 2332; self.orbitRadius = 400 + Math.random() * 200; self.speed = 0.012 + Math.random() * 0.008; self.shootCooldown = 120 + Math.floor(Math.random() * 60); self.maxHealth = 4 + Math.floor(Math.random() * 2); // 4-5 can self.health = self.maxHealth; // --- YENİ: Kalkan özelliği --- self.shield = 0; self.shieldCooldown = 240 + Math.floor(Math.random() * 120); // 4-6 saniyede bir self.takeDamage = function (amount) { if (self.shield > 0) { self.shield--; LK.effects.flashObject(self, 0x00ffff, 200); return; } self.health -= amount; LK.effects.flashObject(self, 0xffff00, 200); if (self.health <= 0) { // Destroy health bar if exists if (self._healthBar) { self._healthBar.destroy(); self._healthBar = null; } // Destroy visible health bar if exists if (self._visHealthBar) { self._visHealthBar.destroy(); self._visHealthBar = null; self._visHealthBarBg = null; self._visHealthBarFg = null; } self.destroy(); if (player._scoreBoost && player._scoreBoost > 0) { score += 2; } else { score++; } updateScoreAndLevel(); if (score > 0 && score % 10 === 0) { increaseDifficulty(); } self._shouldRemove = true; } }; self.update = function () { if (self._frozen && self._frozen > 0) { self.x += Math.sin(self._frozen) * 2; self.y += Math.cos(self._frozen) * 2; return; } // --- YENİ: Kalkan oluşturma --- if (self.shieldCooldown > 0) { self.shieldCooldown--; } else { self.shield = 2; // 2 vuruşluk kalkan self.shieldCooldown = 240 + Math.floor(Math.random() * 120); LK.effects.flashObject(self, 0x00ffff, 200); } // Kalkan efekti için: kalkanı varsa hafif mavi tint if (self.shield > 0 && enemyGfx) { enemyGfx.alpha = 0.7; } else if (enemyGfx) { enemyGfx.alpha = 1.0; } self.angle += self.speed; self.x = self.centerX + Math.cos(self.angle) * self.orbitRadius; self.y = self.centerY + Math.sin(self.angle) * self.orbitRadius; // Ateş etme if (self.shootCooldown > 0) { self.shootCooldown--; } else { self.shootCooldown = 120 + Math.floor(Math.random() * 60); spawnEnemyBullet(self.x, self.y, player.x, player.y); } // --- HEALTH BAR (rectangle) --- // Create health bar if not exists if (!self._visHealthBar) { self._visHealthBar = new Container(); self._visHealthBarBg = new Container(); self._visHealthBarFg = new Container(); self._visHealthBar.addChild(self._visHealthBarBg); self._visHealthBar.addChild(self._visHealthBarFg); game.addChild(self._visHealthBar); } if (self._visHealthBar) { // Position above enemy self._visHealthBar.x = self.x; self._visHealthBar.y = self.y - self.radius - 28; // Health percent var hp = Math.max(0, self.health) / self.maxHealth; // Clamp width var fgWidth = Math.max(24, 180 * hp); self._visHealthBarFg.width = fgWidth; // Color: green > yellow > red if (hp > 0.6) { self._visHealthBarFg.tint = 0x00ff00; } else if (hp > 0.3) { self._visHealthBarFg.tint = 0xffe100; } else { self._visHealthBarFg.tint = 0xff4444; } self._visHealthBar.visible = true; } }; return self; }); // Düşman karakteri 3 (rastgele zıplama, mor kutu) - Enemy3: Ölünce ikiye bölünme yeteneği var Enemy3 = Container.expand(function () { var self = Container.call(this); var enemyGfx = self.attachAsset('enemy3', { anchorX: 0.5, anchorY: 0.5 }); self.radius = enemyGfx.width * 0.5; self.type = 3; self.jumpTimer = 60 + Math.floor(Math.random() * 60); self.targetX = 200 + Math.random() * 1648; self.targetY = 200 + Math.random() * 2332; self.speed = 12 + Math.random() * 6; self.shootCooldown = 100 + Math.floor(Math.random() * 60); self.maxHealth = 2 + Math.floor(Math.random() * 2); // 2-3 can self.health = self.maxHealth; self.takeDamage = function (amount) { self.health -= amount; LK.effects.flashObject(self, 0xffff00, 200); if (self.health <= 0) { // Destroy health bar if exists if (self._healthBar) { self._healthBar.destroy(); self._healthBar = null; } // Destroy visible health bar if exists if (self._visHealthBar) { self._visHealthBar.destroy(); self._visHealthBar = null; self._visHealthBarBg = null; self._visHealthBarFg = null; } // Splitting on death removed self.destroy(); if (player._scoreBoost && player._scoreBoost > 0) { score += 2; } else { score++; } updateScoreAndLevel(); if (score > 0 && score % 10 === 0) { increaseDifficulty(); } self._shouldRemove = true; } }; self.update = function () { if (self._frozen && self._frozen > 0) { self.x += Math.sin(self._frozen) * 2; self.y += Math.cos(self._frozen) * 2; return; } self.jumpTimer--; if (self.jumpTimer <= 0) { self.targetX = 200 + Math.random() * 1648; self.targetY = 200 + Math.random() * 2332; self.jumpTimer = 60 + Math.floor(Math.random() * 60); } var dx = self.targetX - self.x; var dy = self.targetY - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 1) { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } // Ateş etme if (self.shootCooldown > 0) { self.shootCooldown--; } else { self.shootCooldown = 100 + Math.floor(Math.random() * 60); spawnEnemyBullet(self.x, self.y, player.x, player.y); } // --- HEALTH BAR (rectangle) --- // Create health bar if not exists if (!self._visHealthBar) { self._visHealthBar = new Container(); self._visHealthBarBg = new Container(); self._visHealthBarFg = new Container(); self._visHealthBar.addChild(self._visHealthBarBg); self._visHealthBar.addChild(self._visHealthBarFg); game.addChild(self._visHealthBar); } if (self._visHealthBar) { // Position above enemy self._visHealthBar.x = self.x; self._visHealthBar.y = self.y - self.radius - 28; // Health percent var hp = Math.max(0, self.health) / self.maxHealth; // Clamp width var fgWidth = Math.max(24, 180 * hp); self._visHealthBarFg.width = fgWidth; // Color: green > yellow > red if (hp > 0.6) { self._visHealthBarFg.tint = 0x00ff00; } else if (hp > 0.3) { self._visHealthBarFg.tint = 0xffe100; } else { self._visHealthBarFg.tint = 0xff4444; } self._visHealthBar.visible = true; } }; return self; }); // Düşman mermisi var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGfx = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.radius = bulletGfx.width * 0.5; self.vx = 0; self.vy = 0; self.update = function () { self.x += self.vx; self.y += self.vy; }; return self; }); // Oyuncu karakteri var Player = Container.expand(function () { var self = Container.call(this); var playerGfx = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.radius = playerGfx.width * 0.5; self.shootCooldown = 0; // Oyuncuya can ekle self.maxHealth = typeof playerMaxHealth !== "undefined" ? playerMaxHealth : 5; self.health = typeof playerHealth !== "undefined" ? playerHealth : self.maxHealth; self.update = function () { if (self.shootCooldown > 0) self.shootCooldown--; }; return self; }); // Oyuncu mermisi var PlayerBullet = Container.expand(function () { var self = Container.call(this); var bulletGfx = self.attachAsset('playerBullet', { anchorX: 0.5, anchorY: 0.5 }); self.radius = bulletGfx.width * 0.5; self.vx = 0; self.vy = 0; self.update = function () { self.x += self.vx; self.y += self.vy; }; return self; }); // Güçlendirici (PowerUp) kutusu var PowerUp = Container.expand(function () { var self = Container.call(this); var powerGfx = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); self.radius = powerGfx.width * 0.5; self.type = "power"; // Sadece basit ve çalışan powerup efektleri var effects = ["rapid", // Hızlı ateş (fire rate) "triple", // Üçlü atış "shield", // Kalkan "heal" // Can doldur ]; self.effect = effects[Math.floor(Math.random() * effects.length)]; self.update = function () { // Hafifçe döndür powerGfx.rotation += 0.08; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0074D9 }); /**** * Game Code ****/ // Space backgrounds as assets // Global değişkenler // --- SPACE BACKGROUND --- // Space background images (add your own image asset IDs as needed) var spaceBackgrounds = [{ id: 'spacebg1', width: 2048, height: 2732, assetId: '682e6b2ad10b0c0b481370a1' }, { id: 'spacebg2', width: 2048, height: 2732, assetId: '682e6b3fd10b0c0b481370a2' }, { id: 'spacebg3', width: 2048, height: 2732, assetId: '682e6b4ad10b0c0b481370a3' }]; // Register background assets (engine will load them automatically) for (var i = 0; i < spaceBackgrounds.length; i++) {} // Pick a random background var selectedBg = spaceBackgrounds[Math.floor(Math.random() * spaceBackgrounds.length)]; var bgSprite = LK.getAsset(selectedBg.id, { anchorX: 0, anchorY: 0 }); bgSprite.x = 0; bgSprite.y = 0; bgSprite.width = 2048; bgSprite.height = 2732; game.addChildAt(bgSprite, 0); // Add as the bottom-most layer // Coin asset var player; var enemies = []; var playerBullets = []; var enemyBullets = []; var powerUps = []; var coins = []; // Coin objects var coinCount = 0; // Collected coin count var coinTxt = new Text2('₵ ' + coinCount, { size: 70, fill: 0xFFD700, font: "Impact" }); coinTxt.anchor.set(0.5, 0); LK.gui.top.addChild(coinTxt); coinTxt.y = 340; var powerActive = false; var powerTimer = 0; var dragNode = null; var lastPlayerPos = { x: 0, y: 0 }; var score = 0; var level = 1; var gameTick = 0; var spawnTimer = 0; var isGameOver = false; // Combo variables var comboCount = 0; var comboTimer = 0; var maxComboTime = 120; // 2 seconds (120 frames) var maxCombo = 0; // Combo GUI var comboTxt = new Text2('', { size: 80, fill: 0xFFFA00, font: "Impact" }); comboTxt.anchor.set(0.5, 0); LK.gui.top.addChild(comboTxt); comboTxt.y = 260; // Health bar variables var playerMaxHealth = 10; var playerHealth = playerMaxHealth; // Health bar GUI var healthTxt = new Text2('Health: ' + playerHealth, { size: 70, fill: 0xFF4444 }); healthTxt.anchor.set(0.5, 0); LK.gui.top.addChild(healthTxt); healthTxt.y = 180; // --- OYUNU BAŞLAT --- function startGame() { // Oyun değişkenlerini sıfırla isInMainMenu = false; // Oyun başlarken menüden çık score = 0; level = 1; playerHealth = playerMaxHealth; enemies = []; playerBullets = []; enemyBullets = []; powerUps = []; coins = []; powerActive = false; powerTimer = 0; comboCount = 0; comboTimer = 0; maxCombo = 0; isGameOver = false; gameTick = 0; spawnTimer = 0; dragNode = null; lastPlayerPos = { x: 0, y: 0 }; // GUI güncelle updateScoreAndLevel(); if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + (typeof storage.coins === "number" ? storage.coins : 0)); if (typeof player !== "undefined") { if (typeof player.maxHealth !== "undefined") player.maxHealth = playerMaxHealth; if (typeof player.health !== "undefined") player.health = playerHealth; } // Oyuncu konumunu sıfırla if (typeof player !== "undefined") { player.x = 2048 / 2; player.y = 2732 / 2; } } // Start game immediately startGame(); // PowerUp oluşturucu function spawnPowerUp() { var p = new PowerUp(); // Güvenli alan içinde rastgele konum p.x = 200 + Math.random() * 1648; p.y = 200 + Math.random() * 2332; powerUps.push(p); game.addChild(p); } // Coin oluşturucu function spawnCoin(x, y) { var c = new Coin(); // Eğer x, y verilmişse oraya koy, yoksa rastgele if (typeof x === "number" && typeof y === "number") { c.x = x; c.y = y; } else { c.x = 200 + Math.random() * 1648; c.y = 200 + Math.random() * 2332; } coins.push(c); game.addChild(c); } // Skor ve seviye göstergesi var scoreTxt = new Text2('Score: 0', { size: 90, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var levelTxt = new Text2('Level: 1', { size: 60, fill: "#fff" }); levelTxt.anchor.set(0.5, 0); LK.gui.top.addChild(levelTxt); levelTxt.y = 100; // Eğlenceli: Arena event popup var eventPopupTxt = new Text2('', { size: 70, fill: 0xFFFA00, font: "Impact" }); eventPopupTxt.anchor.set(0.5, 0.5); eventPopupTxt.visible = false; LK.gui.center.addChild(eventPopupTxt); // Arena event popup fonksiyonu function showArenaEventPopup(msg) { eventPopupTxt.setText(msg); eventPopupTxt.visible = true; eventPopupTxt.alpha = 1; tween(eventPopupTxt, { alpha: 0 }, { duration: 1200, onFinish: function onFinish() { eventPopupTxt.visible = false; } }); } // Oyuncu oluştur player = new Player(); game.addChild(player); player.x = 2048 / 2; player.y = 2732 / 2; // Düşman oluşturucu function spawnEnemy() { var t = Math.random(); var e; if (t < 0.4) { e = new Enemy(); } else if (t < 0.7) { e = new Enemy2(); } else { e = new Enemy3(); } // Düşmanları güçlendir: seviye arttıkça SADECE can artsın, hız ve atış hızı sabit kalsın if (typeof e.maxHealth !== "undefined") { e.maxHealth += Math.floor(level / 3); e.health = e.maxHealth; } // Hız ve atış hızı artık artmıyor // Rastgele kenardan başlat var edge = Math.floor(Math.random() * 4); if (edge === 0) { // üst e.x = 200 + Math.random() * 1648; e.y = -100; } else if (edge === 1) { // sağ e.x = 2148; e.y = 200 + Math.random() * 2332; } else if (edge === 2) { // alt e.x = 200 + Math.random() * 1648; e.y = 2832; } else { // sol e.x = -100; e.y = 200 + Math.random() * 2332; } enemies.push(e); game.addChild(e); } // Düşman mermisi oluşturucu function spawnEnemyBullet(sx, sy, tx, ty) { var b = new EnemyBullet(); b.x = sx; b.y = sy; var dx = tx - sx; var dy = ty - sy; var dist = Math.sqrt(dx * dx + dy * dy); var speed = 18 + level * 2; b.vx = dx / dist * speed; b.vy = dy / dist * speed; enemyBullets.push(b); game.addChild(b); } // Oyuncu mermisi oluşturucu function spawnPlayerBullet(sx, sy, tx, ty) { var b = new PlayerBullet(); b.x = sx; b.y = sy; var dx = tx - sx; var dy = ty - sy; var dist = Math.sqrt(dx * dx + dy * dy); var speed = 32; b.vx = dx / dist * speed; b.vy = dy / dist * speed; playerBullets.push(b); game.addChild(b); LK.getSound('shoot').play(); } // Skor ve seviye güncelle function updateScoreAndLevel() { if (typeof scoreTxt !== "undefined" && scoreTxt && typeof scoreTxt.setText === "function") { scoreTxt.setText('Score: ' + score); } if (typeof levelTxt !== "undefined" && levelTxt && typeof levelTxt.setText === "function") { levelTxt.setText('Level: ' + level); } if (typeof healthTxt !== "undefined" && healthTxt && typeof healthTxt.setText === "function") { healthTxt.setText('Health: ' + playerHealth); } updateComboText(); } // Kombo GUI güncelle function updateComboText() { if (comboCount > 1) { comboTxt.setText("COMBO x" + comboCount + "!"); comboTxt.visible = true; comboTxt.alpha = 1; } else { comboTxt.visible = false; } } // Oyun zorluğunu artır function increaseDifficulty() { level++; updateScoreAndLevel(); } // Oyun bitti function gameOver() { if (isGameOver) return; isGameOver = true; LK.effects.flashScreen(0xff0000, 1000); LK.getSound('hit').play(); LK.showGameOver(); // --- PROFESSIONAL COIN SHOP PANEL ON GAME OVER --- // Wait for the game over popup to appear, then add the shop panel below "Play Again" LK.setTimeout(function () { // Remove previous shop panel if exists if (typeof gameOverShopPanel !== "undefined" && gameOverShopPanel && gameOverShopPanel.parent) { gameOverShopPanel.parent.removeChild(gameOverShopPanel); } // Create a new panel gameOverShopPanel = new Container(); gameOverShopPanel.width = 500; gameOverShopPanel.height = 600; // Position: center horizontally, below Play Again (y=~900) gameOverShopPanel.x = (LK.gui.center.width ? LK.gui.center.width : 2048) / 2 - 250; gameOverShopPanel.y = 900; // Panel background var panelBg = LK.getAsset('enemy', { anchorX: 0, anchorY: 0 }); panelBg.width = 500; panelBg.height = 600; panelBg.alpha = 0.18; gameOverShopPanel.addChild(panelBg); // Title var shopTitle = new Text2('COIN SHOP', { size: 70, fill: 0xFFD700, font: "Impact" }); shopTitle.anchor.set(0.5, 0); shopTitle.x = 250; shopTitle.y = 18; gameOverShopPanel.addChild(shopTitle); // --- SHOP BUTTONS --- // Health Upgrade Button var shopBtn = new Text2('Buy +1 Health (10₵)', { size: 54, fill: 0x00FF00, font: "Impact" }); shopBtn.anchor.set(0.5, 0); shopBtn.x = 250; shopBtn.y = 80; shopBtn.interactive = true; shopBtn.buttonMode = true; gameOverShopPanel.addChild(shopBtn); // Damage Boost Button var dmgBoostBtn = new Text2('Double Damage (20₵)', { size: 54, fill: 0xFF6600, font: "Impact" }); dmgBoostBtn.anchor.set(0.5, 0); dmgBoostBtn.x = 250; dmgBoostBtn.y = 150; dmgBoostBtn.interactive = true; dmgBoostBtn.buttonMode = true; gameOverShopPanel.addChild(dmgBoostBtn); // Shield Button var shieldBtn = new Text2('Buy Shield (15₵)', { size: 54, fill: 0x00BFFF, font: "Impact" }); shieldBtn.anchor.set(0.5, 0); shieldBtn.x = 250; shieldBtn.y = 220; shieldBtn.interactive = true; shieldBtn.buttonMode = true; gameOverShopPanel.addChild(shieldBtn); // Max Health Upgrade Button var maxHealthBtn = new Text2('Max Health+1 (30₵)', { size: 54, fill: 0xFF00FF, font: "Impact" }); maxHealthBtn.anchor.set(0.5, 0); maxHealthBtn.x = 250; maxHealthBtn.y = 290; maxHealthBtn.interactive = true; maxHealthBtn.buttonMode = true; gameOverShopPanel.addChild(maxHealthBtn); // Rapid Fire Button var rapidBtn = new Text2('Rapid Fire (12₵)', { size: 54, fill: 0x00ffcc, font: "Impact" }); rapidBtn.anchor.set(0.5, 0); rapidBtn.x = 250; rapidBtn.y = 360; rapidBtn.interactive = true; rapidBtn.buttonMode = true; gameOverShopPanel.addChild(rapidBtn); // Triple Shot Button var tripleBtn = new Text2('Triple Shot (18₵)', { size: 54, fill: 0xfffa00, font: "Impact" }); tripleBtn.anchor.set(0.5, 0); tripleBtn.x = 250; tripleBtn.y = 430; tripleBtn.interactive = true; tripleBtn.buttonMode = true; gameOverShopPanel.addChild(tripleBtn); // Full Heal Button var fullHealBtn = new Text2('Full Heal (25₵)', { size: 54, fill: 0xff4444, font: "Impact" }); fullHealBtn.anchor.set(0.5, 0); fullHealBtn.x = 250; fullHealBtn.y = 500; fullHealBtn.interactive = true; fullHealBtn.buttonMode = true; gameOverShopPanel.addChild(fullHealBtn); // --- SHOP BUTTON LOGIC --- // Health shopBtn.down = function (x, y, obj) { if (playerHealth < playerMaxHealth && coinCount >= 10) { playerHealth++; coinCount -= 10; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") player.health = playerHealth; updateScoreAndLevel(); showArenaEventPopup("+1 Health!"); LK.effects.flashObject(player, 0x00ff00, 300); if (playerHealth === playerMaxHealth) { showArenaEventPopup("MAX HEALTH!"); LK.effects.flashScreen(0x00ff00, 400); } } else if (coinCount < 10) { showArenaEventPopup("Not enough coins!"); } else if (playerHealth >= playerMaxHealth) { showArenaEventPopup("Health is full!"); } }; // Damage Boost dmgBoostBtn.down = function (x, y, obj) { if (coinCount >= 20 && !damageBoostActive) { coinCount -= 20; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); damageBoostActive = true; damageBoostTimer = 600; // 10 seconds at 60fps showArenaEventPopup("Double Damage! (10s)"); LK.effects.flashObject(player, 0xFF6600, 300); } else if (coinCount < 20) { showArenaEventPopup("Not enough coins!"); } else if (damageBoostActive) { showArenaEventPopup("Double Damage already active!"); LK.effects.flashScreen(0xff6600, 200); } }; // Shield shieldBtn.down = function (x, y, obj) { if (coinCount >= 15) { coinCount -= 15; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); player._shield = 5; showArenaEventPopup("Shield (5 hits)!"); LK.effects.flashObject(player, 0x00BFFF, 300); } else { showArenaEventPopup("Not enough coins!"); } }; // Max Health Upgrade maxHealthBtn.down = function (x, y, obj) { if (coinCount >= 30) { coinCount -= 30; storage.coins = coinCount; playerMaxHealth++; playerHealth = playerMaxHealth; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") { player.maxHealth = playerMaxHealth; player.health = playerHealth; } updateScoreAndLevel(); showArenaEventPopup("Max Health +1!"); LK.effects.flashObject(player, 0xFF00FF, 300); } else { showArenaEventPopup("Not enough coins!"); } }; // Rapid Fire rapidBtn.down = function (x, y, obj) { if (coinCount >= 12 && !powerActive) { coinCount -= 12; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); powerActive = true; powerTimer = 600; // 10 seconds showArenaEventPopup("Rapid Fire! (10s)"); LK.effects.flashObject(player, 0x00ffcc, 300); } else if (coinCount < 12) { showArenaEventPopup("Not enough coins!"); } else if (powerActive) { showArenaEventPopup("Rapid Fire already active!"); } }; // Triple Shot tripleBtn.down = function (x, y, obj) { if (coinCount >= 18 && (!player._tripleShot || player._tripleShot <= 0)) { coinCount -= 18; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); player._tripleShot = 600; // 10 seconds showArenaEventPopup("Triple Shot! (10s)"); LK.effects.flashObject(player, 0xfffa00, 300); } else if (coinCount < 18) { showArenaEventPopup("Not enough coins!"); } else if (player._tripleShot && player._tripleShot > 0) { showArenaEventPopup("Triple Shot already active!"); } }; // Full Heal fullHealBtn.down = function (x, y, obj) { if (coinCount >= 25 && playerHealth < playerMaxHealth) { coinCount -= 25; storage.coins = coinCount; playerHealth = playerMaxHealth; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") player.health = playerHealth; updateScoreAndLevel(); showArenaEventPopup("Full Health!"); LK.effects.flashObject(player, 0xff4444, 300); } else if (coinCount < 25) { showArenaEventPopup("Not enough coins!"); } else if (playerHealth >= playerMaxHealth) { showArenaEventPopup("Health is already full!"); } }; // Add to game over popup (center overlay) LK.gui.center.addChild(gameOverShopPanel); }, 400); // Wait for popup to appear } // Oyun kazandı function youWin() { showArenaEventPopup("YOU WIN! 🎉"); LK.effects.flashScreen(0x00ffcc, 1000); LK.showYouWin(); } // Sürükleme ve ateş etme function handleMove(x, y, obj) { if (dragNode) { // Hareket farkını uygula var dx = x - lastPlayerPos.x; var dy = y - lastPlayerPos.y; dragNode.x += dx; dragNode.y += dy; // Kullanıcı dostu: Oyuncunun ekran dışına çıkmasını engelle var minX = dragNode.radius + 20; var maxX = 2048 - dragNode.radius - 20; var minY = dragNode.radius + 20; var maxY = 2732 - dragNode.radius - 20; if (dragNode.x < minX) dragNode.x = minX; if (dragNode.x > maxX) dragNode.x = maxX; if (dragNode.y < minY) dragNode.y = minY; if (dragNode.y > maxY) dragNode.y = maxY; lastPlayerPos.x = x; lastPlayerPos.y = y; } } // Oyun alanı dışı kontrolü function isOutOfBounds(obj) { return obj.x < -200 || obj.x > 2248 || obj.y < -200 || obj.y > 2932; } // Oyun ana döngüsü game.update = function () { if (isGameOver) return; gameTick++; // Eğlenceli: Rastgele arena olayları (ör: meteor yağmuru, bonus yağmuru, düşman dondurma) // Her 15 saniyede bir rastgele bir olay tetiklenebilir if (gameTick % 900 === 0 && gameTick > 0) { var eventType = Math.floor(Math.random() * 3); if (eventType === 0) { // Meteor yağmuru: 10 hızlı mermi yukarıdan aşağıya düşer for (var m = 0; m < 10; m++) { var b = new EnemyBullet(); b.x = 200 + Math.random() * 1648; b.y = -80 - m * 60; b.vx = 0; b.vy = 32 + Math.random() * 8; enemyBullets.push(b); game.addChild(b); } // Kısa efekt LK.effects.flashScreen(0xffa500, 400); showArenaEventPopup("Meteor Shower!"); } else if (eventType === 1) { // Bonus rain: 5 powerUps drop at once for (var p = 0; p < 5; p++) { var pu = new PowerUp(); pu.x = 200 + Math.random() * 1648; pu.y = 200 + Math.random() * 2332; powerUps.push(pu); game.addChild(pu); } LK.effects.flashScreen(0x00ffcc, 400); showArenaEventPopup("Bonus Rain!"); } else if (eventType === 2) { // Enemies freeze for 3 seconds for (var i = 0; i < enemies.length; i++) { enemies[i]._frozen = 180; // 3 seconds } LK.effects.flashScreen(0x66ccff, 400); showArenaEventPopup("Enemies Frozen!"); } } // Düşmanları dondurma efekti uygula for (var i = 0; i < enemies.length; i++) { if (enemies[i]._frozen && enemies[i]._frozen > 0) { enemies[i]._frozen--; continue; // update çağrılmasın, düşman hareket etmesin } } // Oyuncu update player.update(); // Oyuncu canını playerHealth ile senkronize et if (typeof player.health !== "undefined" && typeof playerHealth !== "undefined" && player.health !== playerHealth) { player.health = playerHealth; } if (typeof player.maxHealth !== "undefined" && typeof playerMaxHealth !== "undefined" && player.maxHealth !== playerMaxHealth) { player.maxHealth = playerMaxHealth; } // Otomatik ateş etme (her 10 frame'de bir, rapid fire varsa daha hızlı) var shootInterval = powerActive ? 4 : 10; if (!isGameOver && gameTick % shootInterval === 0 && enemies.length > 0) { // En yakın düşmanı bul var minDist = Infinity; var targetEnemy = null; for (var i = 0; i < enemies.length; i++) { var e = enemies[i]; var dx = e.x - player.x; var dy = e.y - player.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < minDist) { minDist = dist; targetEnemy = e; } } if (targetEnemy) { // Triple shot powerup varsa üçlü mermi ateşle if (player._tripleShot && player._tripleShot > 0) { for (var s = -1; s <= 1; s++) { var angle = Math.atan2(targetEnemy.y - player.y, targetEnemy.x - player.x) + s * 0.18; var tx = player.x + Math.cos(angle) * 1000; var ty = player.y + Math.sin(angle) * 1000; spawnPlayerBullet(player.x, player.y, tx, ty); } } else { spawnPlayerBullet(player.x, player.y, targetEnemy.x, targetEnemy.y); } } } // Düşman update for (var i = enemies.length - 1; i >= 0; i--) { var e = enemies[i]; e.update(); // Can barı çizimi (her düşmanın üstünde) if (!e._healthBar) { e._healthBar = new Text2('', { size: 64, fill: 0xFF4444, font: "Impact" // Daha büyük ve kalın font }); e._healthBar.anchor.set(0.5, 1); game.addChild(e._healthBar); } if (typeof e.health !== "undefined" && typeof e.maxHealth !== "undefined") { e._healthBar.setText("♥ " + e.health + "/" + e.maxHealth); e._healthBar.x = e.x; e._healthBar.y = e.y - e.radius - 18; e._healthBar.visible = true; } else { e._healthBar.visible = false; } // Çarpışma: oyuncu & düşman if (player.intersects(e)) { if (player._shield && player._shield > 0) { // Kalkan varsa hasar alma, kalkanı azalt player._shield--; LK.effects.flashObject(player, 0x00ffff, 400); if (player._shield === 0) { showArenaEventPopup("Shield Broken!"); } else { showArenaEventPopup("Shield: " + player._shield + " hits left!"); } } else { playerHealth--; if (typeof player.health !== "undefined") player.health = playerHealth; updateScoreAndLevel(); LK.effects.flashObject(player, 0xff4444, 400); if (playerHealth <= 0) { gameOver(); return; } } // Düşmanı yok et, can azalınca if (typeof e.takeDamage === "function") { e.takeDamage(e.health); // Tüm canı gitmeli if (e._shouldRemove) { if (e._healthBar) { e._healthBar.destroy(); } // COIN: Düşman öldüğünde coin spawn et spawnCoin(e.x, e.y); enemies.splice(i, 1); // KOMBO: Düşman öldürünce kombo artır comboCount++; comboTimer = maxComboTime; if (comboCount > maxCombo) maxCombo = comboCount; updateComboText(); continue; } } else { e.destroy(); if (e._healthBar) { e._healthBar.destroy(); } // COIN: Düşman öldüğünde coin spawn et spawnCoin(e.x, e.y); enemies.splice(i, 1); // KOMBO: Düşman öldürünce kombo artır comboCount++; comboTimer = maxComboTime; if (comboCount > maxCombo) maxCombo = comboCount; updateComboText(); continue; } } // Düşman oyun dışıysa sil if (isOutOfBounds(e)) { if (e._healthBar) { e._healthBar.destroy(); } e.destroy(); enemies.splice(i, 1); } } // Oyuncu mermisi update for (var i = playerBullets.length - 1; i >= 0; i--) { var b = playerBullets[i]; b.update(); var hit = false; // Düşmanlara çarpma for (var j = enemies.length - 1; j >= 0; j--) { var e = enemies[j]; if (b.intersects(e)) { LK.getSound('hit').play(); if (typeof e.takeDamage === "function") { e.takeDamage(1); if (e._shouldRemove) { enemies.splice(j, 1); } } hit = true; break; } } if (hit || isOutOfBounds(b)) { b.destroy(); playerBullets.splice(i, 1); } } // Düşman mermisi update for (var i = enemyBullets.length - 1; i >= 0; i--) { var b = enemyBullets[i]; b.update(); // Oyuncuya çarpma if (b.intersects(player)) { if (player._shield && player._shield > 0) { // Kalkan varsa hasar alma, kalkanı azalt player._shield--; LK.effects.flashObject(player, 0x00ffff, 400); if (player._shield === 0) { showArenaEventPopup("Shield Broken!"); } else { showArenaEventPopup("Shield: " + player._shield + " hits left!"); } } else { playerHealth--; if (typeof player.health !== "undefined") player.health = playerHealth; updateScoreAndLevel(); LK.effects.flashObject(player, 0xff4444, 400); if (playerHealth <= 0) { b.destroy(); enemyBullets.splice(i, 1); gameOver(); return; } } b.destroy(); enemyBullets.splice(i, 1); continue; } if (isOutOfBounds(b)) { b.destroy(); enemyBullets.splice(i, 1); } } // KOMBO zamanlayıcı: Kombo süresi dolarsa sıfırla if (comboCount > 0) { comboTimer--; if (comboTimer <= 0) { // Show fun popup for max combo if it was a big combo if (comboCount >= 5) { showArenaEventPopup("AWESOME COMBO x" + comboCount + "!"); LK.effects.flashScreen(0xffe100, 400); } else if (comboCount >= 3) { showArenaEventPopup("Combo x" + comboCount + "!"); } comboCount = 0; updateComboText(); } } // Fun popup: Level up if (typeof lastLevel === "undefined") { lastLevel = level; } if (level > lastLevel) { showArenaEventPopup("LEVEL UP! Level " + level); LK.effects.flashScreen(0x00ff00, 400); lastLevel = level; } // Fun popup: Coin milestone if (typeof lastCoinMilestone === "undefined") { lastCoinMilestone = 0; } if (coinCount >= lastCoinMilestone + 10) { showArenaEventPopup("Coin Collector! ₵" + coinCount); LK.effects.flashScreen(0xffd700, 300); lastCoinMilestone = coinCount - coinCount % 10; } // PowerUp update ve çarpışma for (var i = powerUps.length - 1; i >= 0; i--) { var p = powerUps[i]; p.update(); if (player.intersects(p)) { // PowerUp alındı var effect = p.effect; var popupMsg = ""; if (effect === "rapid") { // Hızlı ateş: 10 saniye boyunca 2 kat hızlı ateş powerActive = true; powerTimer = 600; popupMsg = "RAPID FIRE! (10s)"; } else if (effect === "triple") { // 10 seconds of triple shot player._tripleShot = 600; popupMsg = "TRIPLE SHOT! (10s)"; } else if (effect === "shield") { // 5-hit shield player._shield = 5; popupMsg = "Shield (5 hits)!"; } else if (effect === "heal") { // Restore all health playerHealth = playerMaxHealth; if (typeof player.health !== "undefined") player.health = playerHealth; updateScoreAndLevel(); popupMsg = "Full Health!"; } LK.effects.flashObject(player, 0x00ffcc, 400); showArenaEventPopup("PowerUp: " + popupMsg); p.destroy(); powerUps.splice(i, 1); } else if (isOutOfBounds(p)) { p.destroy(); powerUps.splice(i, 1); } } // Coin update ve toplama for (var i = coins.length - 1; i >= 0; i--) { var c = coins[i]; c.update(); if (player.intersects(c)) { coinCount++; coinTxt.setText('₵ ' + coinCount); // COIN: Save permanently storage.coins = coinCount; LK.effects.flashObject(player, 0xFFD700, 200); // Fun popup: First coin if (coinCount === 1) { showArenaEventPopup("First Coin Collected!"); LK.effects.flashScreen(0xffd700, 300); } c.destroy(); coins.splice(i, 1); } else if (isOutOfBounds(c)) { c.destroy(); coins.splice(i, 1); } } // PowerUp etkisi süresi if (powerActive) { powerTimer--; if (powerTimer <= 0) { powerActive = false; } } // Triple shot süresi azalt if (player._tripleShot && player._tripleShot > 0) { player._tripleShot--; if (player._tripleShot <= 0) { player._tripleShot = 0; } } // PowerUp spawn (her 6 saniyede bir) if (gameTick % 360 === 0) { spawnPowerUp(); } // COIN: Sık sık rastgele coin spawn et (her 60 frame'de bir, %60 olasılıkla) if (gameTick % 60 === 0) { if (Math.random() < 0.6) { spawnCoin(); } } // Düşman spawn var spawnInterval = Math.max(60 - level * 2, 20); if (gameTick % spawnInterval === 0) { spawnEnemy(); } }; // Sürükleme başlat game.down = function (x, y, obj) { // Oyuncuya tıklanırsa sürükle var px = player.x, py = player.y; var dx = x - px, dy = y - py; var dist = Math.sqrt(dx * dx + dy * dy); // Kullanıcı dostu: Oyuncunun üstüne dokunulduysa sürüklemeye başla, yoksa ateş et if (dist < player.radius + 80) { // daha geniş alan, daha kolay sürükleme dragNode = player; lastPlayerPos.x = x; lastPlayerPos.y = y; // Sürükleme başladığında ateş etme, yanlışlıkla ateşlemeyi önle // Drag threshold: set a flag to check if drag distance exceeds a threshold before firing dragNode._dragStarted = false; dragNode._dragStartX = x; dragNode._dragStartY = y; dragNode._dragStartTime = Date.now(); } else { // Oyuncu mermisi ateşle // (Kaldırıldı: tap-to-shoot kodu artık yok) } }; // Sürükleme bırak game.up = function (x, y, obj) { if (dragNode && typeof dragNode._dragStarted !== "undefined") { // Eğer drag başlamadıysa ve kısa sürede bırakıldıysa, ateş et (tap-to-shoot) var dragDx = x - dragNode._dragStartX; var dragDy = y - dragNode._dragStartY; var dragDist = Math.sqrt(dragDx * dragDx + dragDy * dragDy); var dragTime = Date.now() - (dragNode._dragStartTime || 0); if (!dragNode._dragStarted && dragDist < 24 && dragTime < 200) { spawnPlayerBullet(player.x, player.y, x, y); } dragNode._dragStarted = false; dragNode._dragStartX = 0; dragNode._dragStartY = 0; dragNode._dragStartTime = 0; } dragNode = null; // Kullanıcı dostu: Sürükleme bırakıldığında son pozisyonu güncelle lastPlayerPos.x = 0; lastPlayerPos.y = 0; }; // Sürükleme hareketi: Oyuncu mouse ile birlikte hareket etsin game.move = function (x, y, obj) { // Oyuncu mouse ile birlikte hareket etsin if (player) { // Kullanıcı dostu: Oyuncunun ekran dışına çıkmasını engelle var minX = player.radius + 20; var maxX = 2048 - player.radius - 20; var minY = player.radius + 20; var maxY = 2732 - player.radius - 20; player.x = x; player.y = y; if (player.x < minX) player.x = minX; if (player.x > maxX) player.x = maxX; if (player.y < minY) player.y = minY; if (player.y > maxY) player.y = maxY; } }; // Oyun başında skor, seviye ve canı sıfırla score = 0; level = 1; playerHealth = playerMaxHealth; // COIN: Kalıcı coin sayısını yükle coinCount = typeof storage.coins === "number" ? storage.coins : 0; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") { if (typeof player.maxHealth !== "undefined") player.maxHealth = playerMaxHealth; if (typeof player.health !== "undefined") player.health = playerHealth; } // --- PROFESSIONAL COIN SHOP PANEL --- // Create a semi-transparent panel at the bottom right var shopPanel = new Container(); shopPanel.x = 2048 - 520; shopPanel.y = 2732 - 620; shopPanel.width = 500; shopPanel.height = 600; shopPanel.visible = true; LK.gui.bottomRight.addChild(shopPanel); // Panel background var panelBg = LK.getAsset('enemy', { anchorX: 0, anchorY: 0 }); panelBg.width = 500; panelBg.height = 600; panelBg.alpha = 0.18; shopPanel.addChild(panelBg); // Title var shopTitle = new Text2('COIN SHOP', { size: 70, fill: 0xFFD700, font: "Impact" }); shopTitle.anchor.set(0.5, 0); shopTitle.x = 250; shopTitle.y = 18; shopPanel.addChild(shopTitle); // --- SHOP BUTTONS --- // Health Upgrade Button var shopBtn = new Text2('Buy +1 Health (10₵)', { size: 54, fill: 0x00FF00, font: "Impact" }); shopBtn.anchor.set(0.5, 0); shopBtn.x = 250; shopBtn.y = 80; shopBtn.interactive = true; shopBtn.buttonMode = true; shopPanel.addChild(shopBtn); // Damage Boost Button var dmgBoostBtn = new Text2('Double Damage (20₵)', { size: 54, fill: 0xFF6600, font: "Impact" }); dmgBoostBtn.anchor.set(0.5, 0); dmgBoostBtn.x = 250; dmgBoostBtn.y = 150; dmgBoostBtn.interactive = true; dmgBoostBtn.buttonMode = true; shopPanel.addChild(dmgBoostBtn); // Shield Button var shieldBtn = new Text2('Buy Shield (15₵)', { size: 54, fill: 0x00BFFF, font: "Impact" }); shieldBtn.anchor.set(0.5, 0); shieldBtn.x = 250; shieldBtn.y = 220; shieldBtn.interactive = true; shieldBtn.buttonMode = true; shopPanel.addChild(shieldBtn); // Max Health Upgrade Button var maxHealthBtn = new Text2('Max Health+1 (30₵)', { size: 54, fill: 0xFF00FF, font: "Impact" }); maxHealthBtn.anchor.set(0.5, 0); maxHealthBtn.x = 250; maxHealthBtn.y = 290; maxHealthBtn.interactive = true; maxHealthBtn.buttonMode = true; shopPanel.addChild(maxHealthBtn); // --- NEW UPGRADES --- // Rapid Fire Button var rapidBtn = new Text2('Rapid Fire (12₵)', { size: 54, fill: 0x00ffcc, font: "Impact" }); rapidBtn.anchor.set(0.5, 0); rapidBtn.x = 250; rapidBtn.y = 360; rapidBtn.interactive = true; rapidBtn.buttonMode = true; shopPanel.addChild(rapidBtn); // Triple Shot Button var tripleBtn = new Text2('Triple Shot (18₵)', { size: 54, fill: 0xfffa00, font: "Impact" }); tripleBtn.anchor.set(0.5, 0); tripleBtn.x = 250; tripleBtn.y = 430; tripleBtn.interactive = true; tripleBtn.buttonMode = true; shopPanel.addChild(tripleBtn); // Full Heal Button var fullHealBtn = new Text2('Full Heal (25₵)', { size: 54, fill: 0xff4444, font: "Impact" }); fullHealBtn.anchor.set(0.5, 0); fullHealBtn.x = 250; fullHealBtn.y = 500; fullHealBtn.interactive = true; fullHealBtn.buttonMode = true; shopPanel.addChild(fullHealBtn); // --- SHOP BUTTON LOGIC --- // Health shopBtn.down = function (x, y, obj) { if (playerHealth < playerMaxHealth && coinCount >= 10) { playerHealth++; coinCount -= 10; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") player.health = playerHealth; updateScoreAndLevel(); showArenaEventPopup("+1 Health!"); LK.effects.flashObject(player, 0x00ff00, 300); if (playerHealth === playerMaxHealth) { showArenaEventPopup("MAX HEALTH!"); LK.effects.flashScreen(0x00ff00, 400); } } else if (coinCount < 10) { showArenaEventPopup("Not enough coins!"); } else if (playerHealth >= playerMaxHealth) { showArenaEventPopup("Health is full!"); } }; // Damage Boost var damageBoostActive = false; var damageBoostTimer = 0; dmgBoostBtn.down = function (x, y, obj) { if (coinCount >= 20 && !damageBoostActive) { coinCount -= 20; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); damageBoostActive = true; damageBoostTimer = 600; // 10 seconds at 60fps showArenaEventPopup("Double Damage! (10s)"); LK.effects.flashObject(player, 0xFF6600, 300); } else if (coinCount < 20) { showArenaEventPopup("Not enough coins!"); } else if (damageBoostActive) { showArenaEventPopup("Double Damage already active!"); LK.effects.flashScreen(0xff6600, 200); } }; // Shield shieldBtn.down = function (x, y, obj) { if (coinCount >= 15) { coinCount -= 15; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); player._shield = 5; showArenaEventPopup("Shield (5 hits)!"); LK.effects.flashObject(player, 0x00BFFF, 300); } else { showArenaEventPopup("Not enough coins!"); } }; // Max Health Upgrade maxHealthBtn.down = function (x, y, obj) { if (coinCount >= 30) { coinCount -= 30; storage.coins = coinCount; playerMaxHealth++; playerHealth = playerMaxHealth; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") { player.maxHealth = playerMaxHealth; player.health = playerHealth; } updateScoreAndLevel(); showArenaEventPopup("Max Health +1!"); LK.effects.flashObject(player, 0xFF00FF, 300); } else { showArenaEventPopup("Not enough coins!"); } }; // Rapid Fire rapidBtn.down = function (x, y, obj) { if (coinCount >= 12 && !powerActive) { coinCount -= 12; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); powerActive = true; powerTimer = 600; // 10 seconds showArenaEventPopup("Rapid Fire! (10s)"); LK.effects.flashObject(player, 0x00ffcc, 300); } else if (coinCount < 12) { showArenaEventPopup("Not enough coins!"); } else if (powerActive) { showArenaEventPopup("Rapid Fire already active!"); } }; // Triple Shot tripleBtn.down = function (x, y, obj) { if (coinCount >= 18 && (!player._tripleShot || player._tripleShot <= 0)) { coinCount -= 18; storage.coins = coinCount; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); player._tripleShot = 600; // 10 seconds showArenaEventPopup("Triple Shot! (10s)"); LK.effects.flashObject(player, 0xfffa00, 300); } else if (coinCount < 18) { showArenaEventPopup("Not enough coins!"); } else if (player._tripleShot && player._tripleShot > 0) { showArenaEventPopup("Triple Shot already active!"); } }; // Full Heal fullHealBtn.down = function (x, y, obj) { if (coinCount >= 25 && playerHealth < playerMaxHealth) { coinCount -= 25; storage.coins = coinCount; playerHealth = playerMaxHealth; if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount); if (typeof player !== "undefined") player.health = playerHealth; updateScoreAndLevel(); showArenaEventPopup("Full Health!"); LK.effects.flashObject(player, 0xff4444, 300); } else if (coinCount < 25) { showArenaEventPopup("Not enough coins!"); } else if (playerHealth >= playerMaxHealth) { showArenaEventPopup("Health is already full!"); } }; // --- SHOP PANEL END --- // In game.update, handle damage boost timer var _oldGameUpdate = game.update; game.update = function () { if (typeof _oldGameUpdate === "function") _oldGameUpdate.apply(this, arguments); // Damage boost timer logic if (damageBoostActive) { damageBoostTimer--; if (damageBoostTimer <= 0) { damageBoostActive = false; showArenaEventPopup("Double Damage ended!"); } } }; // Patch PlayerBullet to do double damage if boost is active var _oldPlayerBulletUpdate = PlayerBullet.prototype.update; PlayerBullet.prototype.update = function () { if (typeof _oldPlayerBulletUpdate === "function") _oldPlayerBulletUpdate.apply(this, arguments); // No-op, actual damage logic is in main game loop }; // Patch main game loop for double damage var _oldPlayerBulletsLoop = false; if (!window._patchedPlayerBulletsLoop) { _oldPlayerBulletsLoop = true; window._patchedPlayerBulletsLoop = true; var _oldGameUpdate2 = game.update; game.update = function () { // Call original update if (typeof _oldGameUpdate2 === "function") _oldGameUpdate2.apply(this, arguments); // Patch player bullet damage for (var i = playerBullets.length - 1; i >= 0; i--) { var b = playerBullets[i]; var hit = false; for (var j = enemies.length - 1; j >= 0; j--) { var e = enemies[j]; if (b.intersects(e)) { LK.getSound('hit').play(); if (typeof e.takeDamage === "function") { if (damageBoostActive) { e.takeDamage(2); // Double damage } else { e.takeDamage(1); } if (e._shouldRemove) { enemies.splice(j, 1); } } hit = true; break; } } if (hit || isOutOfBounds(b)) { b.destroy(); playerBullets.splice(i, 1); } } }; } updateScoreAndLevel();
===================================================================
--- original.js
+++ change.js
@@ -735,8 +735,248 @@
isGameOver = true;
LK.effects.flashScreen(0xff0000, 1000);
LK.getSound('hit').play();
LK.showGameOver();
+ // --- PROFESSIONAL COIN SHOP PANEL ON GAME OVER ---
+ // Wait for the game over popup to appear, then add the shop panel below "Play Again"
+ LK.setTimeout(function () {
+ // Remove previous shop panel if exists
+ if (typeof gameOverShopPanel !== "undefined" && gameOverShopPanel && gameOverShopPanel.parent) {
+ gameOverShopPanel.parent.removeChild(gameOverShopPanel);
+ }
+ // Create a new panel
+ gameOverShopPanel = new Container();
+ gameOverShopPanel.width = 500;
+ gameOverShopPanel.height = 600;
+ // Position: center horizontally, below Play Again (y=~900)
+ gameOverShopPanel.x = (LK.gui.center.width ? LK.gui.center.width : 2048) / 2 - 250;
+ gameOverShopPanel.y = 900;
+ // Panel background
+ var panelBg = LK.getAsset('enemy', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ panelBg.width = 500;
+ panelBg.height = 600;
+ panelBg.alpha = 0.18;
+ gameOverShopPanel.addChild(panelBg);
+ // Title
+ var shopTitle = new Text2('COIN SHOP', {
+ size: 70,
+ fill: 0xFFD700,
+ font: "Impact"
+ });
+ shopTitle.anchor.set(0.5, 0);
+ shopTitle.x = 250;
+ shopTitle.y = 18;
+ gameOverShopPanel.addChild(shopTitle);
+ // --- SHOP BUTTONS ---
+ // Health Upgrade Button
+ var shopBtn = new Text2('Buy +1 Health (10₵)', {
+ size: 54,
+ fill: 0x00FF00,
+ font: "Impact"
+ });
+ shopBtn.anchor.set(0.5, 0);
+ shopBtn.x = 250;
+ shopBtn.y = 80;
+ shopBtn.interactive = true;
+ shopBtn.buttonMode = true;
+ gameOverShopPanel.addChild(shopBtn);
+ // Damage Boost Button
+ var dmgBoostBtn = new Text2('Double Damage (20₵)', {
+ size: 54,
+ fill: 0xFF6600,
+ font: "Impact"
+ });
+ dmgBoostBtn.anchor.set(0.5, 0);
+ dmgBoostBtn.x = 250;
+ dmgBoostBtn.y = 150;
+ dmgBoostBtn.interactive = true;
+ dmgBoostBtn.buttonMode = true;
+ gameOverShopPanel.addChild(dmgBoostBtn);
+ // Shield Button
+ var shieldBtn = new Text2('Buy Shield (15₵)', {
+ size: 54,
+ fill: 0x00BFFF,
+ font: "Impact"
+ });
+ shieldBtn.anchor.set(0.5, 0);
+ shieldBtn.x = 250;
+ shieldBtn.y = 220;
+ shieldBtn.interactive = true;
+ shieldBtn.buttonMode = true;
+ gameOverShopPanel.addChild(shieldBtn);
+ // Max Health Upgrade Button
+ var maxHealthBtn = new Text2('Max Health+1 (30₵)', {
+ size: 54,
+ fill: 0xFF00FF,
+ font: "Impact"
+ });
+ maxHealthBtn.anchor.set(0.5, 0);
+ maxHealthBtn.x = 250;
+ maxHealthBtn.y = 290;
+ maxHealthBtn.interactive = true;
+ maxHealthBtn.buttonMode = true;
+ gameOverShopPanel.addChild(maxHealthBtn);
+ // Rapid Fire Button
+ var rapidBtn = new Text2('Rapid Fire (12₵)', {
+ size: 54,
+ fill: 0x00ffcc,
+ font: "Impact"
+ });
+ rapidBtn.anchor.set(0.5, 0);
+ rapidBtn.x = 250;
+ rapidBtn.y = 360;
+ rapidBtn.interactive = true;
+ rapidBtn.buttonMode = true;
+ gameOverShopPanel.addChild(rapidBtn);
+ // Triple Shot Button
+ var tripleBtn = new Text2('Triple Shot (18₵)', {
+ size: 54,
+ fill: 0xfffa00,
+ font: "Impact"
+ });
+ tripleBtn.anchor.set(0.5, 0);
+ tripleBtn.x = 250;
+ tripleBtn.y = 430;
+ tripleBtn.interactive = true;
+ tripleBtn.buttonMode = true;
+ gameOverShopPanel.addChild(tripleBtn);
+ // Full Heal Button
+ var fullHealBtn = new Text2('Full Heal (25₵)', {
+ size: 54,
+ fill: 0xff4444,
+ font: "Impact"
+ });
+ fullHealBtn.anchor.set(0.5, 0);
+ fullHealBtn.x = 250;
+ fullHealBtn.y = 500;
+ fullHealBtn.interactive = true;
+ fullHealBtn.buttonMode = true;
+ gameOverShopPanel.addChild(fullHealBtn);
+ // --- SHOP BUTTON LOGIC ---
+ // Health
+ shopBtn.down = function (x, y, obj) {
+ if (playerHealth < playerMaxHealth && coinCount >= 10) {
+ playerHealth++;
+ coinCount -= 10;
+ storage.coins = coinCount;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ if (typeof player !== "undefined") player.health = playerHealth;
+ updateScoreAndLevel();
+ showArenaEventPopup("+1 Health!");
+ LK.effects.flashObject(player, 0x00ff00, 300);
+ if (playerHealth === playerMaxHealth) {
+ showArenaEventPopup("MAX HEALTH!");
+ LK.effects.flashScreen(0x00ff00, 400);
+ }
+ } else if (coinCount < 10) {
+ showArenaEventPopup("Not enough coins!");
+ } else if (playerHealth >= playerMaxHealth) {
+ showArenaEventPopup("Health is full!");
+ }
+ };
+ // Damage Boost
+ dmgBoostBtn.down = function (x, y, obj) {
+ if (coinCount >= 20 && !damageBoostActive) {
+ coinCount -= 20;
+ storage.coins = coinCount;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ damageBoostActive = true;
+ damageBoostTimer = 600; // 10 seconds at 60fps
+ showArenaEventPopup("Double Damage! (10s)");
+ LK.effects.flashObject(player, 0xFF6600, 300);
+ } else if (coinCount < 20) {
+ showArenaEventPopup("Not enough coins!");
+ } else if (damageBoostActive) {
+ showArenaEventPopup("Double Damage already active!");
+ LK.effects.flashScreen(0xff6600, 200);
+ }
+ };
+ // Shield
+ shieldBtn.down = function (x, y, obj) {
+ if (coinCount >= 15) {
+ coinCount -= 15;
+ storage.coins = coinCount;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ player._shield = 5;
+ showArenaEventPopup("Shield (5 hits)!");
+ LK.effects.flashObject(player, 0x00BFFF, 300);
+ } else {
+ showArenaEventPopup("Not enough coins!");
+ }
+ };
+ // Max Health Upgrade
+ maxHealthBtn.down = function (x, y, obj) {
+ if (coinCount >= 30) {
+ coinCount -= 30;
+ storage.coins = coinCount;
+ playerMaxHealth++;
+ playerHealth = playerMaxHealth;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ if (typeof player !== "undefined") {
+ player.maxHealth = playerMaxHealth;
+ player.health = playerHealth;
+ }
+ updateScoreAndLevel();
+ showArenaEventPopup("Max Health +1!");
+ LK.effects.flashObject(player, 0xFF00FF, 300);
+ } else {
+ showArenaEventPopup("Not enough coins!");
+ }
+ };
+ // Rapid Fire
+ rapidBtn.down = function (x, y, obj) {
+ if (coinCount >= 12 && !powerActive) {
+ coinCount -= 12;
+ storage.coins = coinCount;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ powerActive = true;
+ powerTimer = 600; // 10 seconds
+ showArenaEventPopup("Rapid Fire! (10s)");
+ LK.effects.flashObject(player, 0x00ffcc, 300);
+ } else if (coinCount < 12) {
+ showArenaEventPopup("Not enough coins!");
+ } else if (powerActive) {
+ showArenaEventPopup("Rapid Fire already active!");
+ }
+ };
+ // Triple Shot
+ tripleBtn.down = function (x, y, obj) {
+ if (coinCount >= 18 && (!player._tripleShot || player._tripleShot <= 0)) {
+ coinCount -= 18;
+ storage.coins = coinCount;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ player._tripleShot = 600; // 10 seconds
+ showArenaEventPopup("Triple Shot! (10s)");
+ LK.effects.flashObject(player, 0xfffa00, 300);
+ } else if (coinCount < 18) {
+ showArenaEventPopup("Not enough coins!");
+ } else if (player._tripleShot && player._tripleShot > 0) {
+ showArenaEventPopup("Triple Shot already active!");
+ }
+ };
+ // Full Heal
+ fullHealBtn.down = function (x, y, obj) {
+ if (coinCount >= 25 && playerHealth < playerMaxHealth) {
+ coinCount -= 25;
+ storage.coins = coinCount;
+ playerHealth = playerMaxHealth;
+ if (typeof coinTxt !== "undefined") coinTxt.setText('₵ ' + coinCount);
+ if (typeof player !== "undefined") player.health = playerHealth;
+ updateScoreAndLevel();
+ showArenaEventPopup("Full Health!");
+ LK.effects.flashObject(player, 0xff4444, 300);
+ } else if (coinCount < 25) {
+ showArenaEventPopup("Not enough coins!");
+ } else if (playerHealth >= playerMaxHealth) {
+ showArenaEventPopup("Health is already full!");
+ }
+ };
+ // Add to game over popup (center overlay)
+ LK.gui.center.addChild(gameOverShopPanel);
+ }, 400); // Wait for popup to appear
}
// Oyun kazandı
function youWin() {
showArenaEventPopup("YOU WIN! 🎉");
powerup. In-Game asset. 2d. High contrast. No shadows
robot enemy. In-Game asset. 2d. High contrast. No shadows
green robot enemy. In-Game asset. 2d. High contrast. No shadows
purple robot enemy. In-Game asset. 2d. High contrast. No shadows
player robot. In-Game asset. 2d. High contrast. No shadows
robot ammo. In-Game asset. 2d. High contrast. No shadows
coin. In-Game asset. 2d. High contrast. No shadows
robot ammo very red very big. In-Game asset. 2d. High contrast. No shadows
2d space bg. In-Game asset. 2d. High contrast. No shadows