User prompt
Score göstergesini sol aşağıya al
User prompt
can değeri 0 olunca oyun bitsin
User prompt
Oyun bitince ne kadar güçlendirme sahip oldığumu görebileceğim bir gösterge ekle
User prompt
Please fix the bug: 'TypeError: LK.isPaused is not a function' in or related to this line: 'upgradesText.visible = LK.isPaused();' Line Number: 464
User prompt
Upgrades göstergesi, oyun bitince veya durdurulunca gözüksün.
User prompt
Please fix the bug: 'TypeError: LK.isPaused is not a function' in or related to this line: 'upgradesText.visible = LK.isPaused();' Line Number: 464
User prompt
Score göstergesini sol aşağıya al ve upgrade’leri oyun duraklatılınca görünecek şekilde değiştir. Upgrade’ler sağ aşağıda gözüksün.
User prompt
canavarların can göstergelerini biraz daha belirgin yap
User prompt
arka plan akıyormuş gibi gözükmesini istiyorum ve tercih ettiğim bir resim olmasını istiyorum
User prompt
upgrade ile ilgili şeyleri kaldırmanı istiyorum
User prompt
Boss öldükten sonra, can yenileme özelliğini geliştiren bir ek özellik düşsün. Bu özellik sayesinde, boss öldürüldükten sonra alınan tüm can yenileme güçlendirmeleri +2 can versin. Bu artış en fazla +3’e kadar çıkabilsin. +3 seviyesine ulaşıldıktan sonra, oyuncu her boss öldürdüğünde ekstra +5 hasar kazansın.
User prompt
powerup güçlendirmesini kaldır
User prompt
İyileştirmeyi ilk defa alırken can bir bir artıyor ama 10 cana ulaşıldıktan sonra, hasar alıp can 5’e düştüğünde tekrar iyileştirme alındığında can bir anda 10 oluyor; bunu düzelt. İyileştirme alındığında can, sadece +1 +1 olarak artsın ve 10’u geçmesin. Ayrıca bunu sadece 10 için düşünme; örneğin, canım 7 oldu ve hasar alıp 3’e düştüyse, tekrar can aldığımda bir anda 8 olmasın. Her iyileştirme +1 olarak etki etsin.
User prompt
Multishot 5'e ulaştıktan sonra 6. kez Multishot güçlendirmesi alındığında, mermi sayısı 1'e düşsün ama hasara +3 yerine sadece +1 eklensin. Ayrıca, boss düşmanı her 2 dakikada bir gelsin. Oyunda ne kadar süre geçtiğini görebilmek için bir timer da ekle.
User prompt
Her 2 dakikada bir gelen bir boss olsun. Bu düşmanın ilk gelişinde 1000 canı olsun, sonraki gelişlerinde ise canı her seferinde 1000 artarak gelsin. Ayrıca, oyuncunun sahip olabileceği maksimum can 10 olsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
super enemy ile ilgili şeyleri kaldır
User prompt
super enemy i kaldır ve maksimum can limitini kaldır
User prompt
HealthUpgrade bir bir artış sağlasın ve üst sınır olarak 10 olsun. Ayrıca, Super Enemy'nin başlangıç canı 1000 olarak ayarlansın ve Super Enemy oyuncuya hasar verirse, 5 hasar versin.
User prompt
Düşman ölünce etrafa az miktarda partikül saçılsın ve düşman, kısa bir süre sonra tamamen kaybolsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Düşmanların ölümüne efekti ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Düşmanların ölüm efektini kaldır
User prompt
Düşmanlar öldükten sonra patlama efekti kalıcı olmuş; bu yüzden düşman hala gözükmeye devam ediyor. Bunu düzelt: patlama efekti bittikten sonra düşman tamamen kaybolsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Düşmanların ölmesine hafif bir patlama efekti ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hasar alma efektini ekranın tamamına değil, sadece karakter üzerinde yap. Karakter hasar aldığında kısa süreliğine kırmızıya dönsün, sonra tekrar normale dönsün. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.damage = 1; self.lastY = 0; self.update = function () { self.y -= self.speed; }; return self; }); var DamageUpgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('damageUpgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; self.health = 3; self.maxHealth = 3; self.lastY = 0; self.healthText = new Text2(self.health.toString(), { size: 30, fill: 0xFFFFFF }); self.healthText.anchor.set(0.5, 0.5); self.healthText.x = 0; self.healthText.y = -40; self.addChild(self.healthText); self.takeDamage = function (damage) { self.health -= damage; self.healthText.setText(self.health.toString()); LK.effects.flashObject(self, 0xFFFFFF, 200); if (self.health <= 0) { return true; // Enemy is dead } return false; }; self.update = function () { self.y += self.speed; }; return self; }); var FireRateUpgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('fireRateUpgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); var HealthUpgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('healthUpgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); var MultishotUpgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('multishotUpgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.health = 3; self.maxHealth = 3; self.speed = 5; self.fireRate = 1; // Start at 1 and increment up self.bulletDamage = 1; self.multiShot = 1; // Number of bullets per shot self.lastShot = 0; self.shoot = function () { if (LK.ticks - self.lastShot >= Math.floor(60 / self.fireRate)) { self.lastShot = LK.ticks; LK.getSound('shoot').play(); for (var i = 0; i < self.multiShot; i++) { var bullet = new Bullet(); bullet.x = self.x + (i - (self.multiShot - 1) / 2) * 20; bullet.y = self.y - 40; bullet.damage = self.bulletDamage; bullet.lastY = bullet.y; bullets.push(bullet); game.addChild(bullet); } } }; self.upgradeFireRate = function () { if (self.fireRate < 8) { self.fireRate += 1; } }; self.upgradeDamage = function () { self.bulletDamage += 1; }; self.upgradeMultiShot = function () { if (self.multiShot >= 5) { // Reset multishot to 1 and add 3 damage self.multiShot = 1; self.bulletDamage += 3; } else { self.multiShot += 1; } }; self.takeDamage = function () { self.health--; LK.getSound('damage').play(); // Add red tint animation to player tween(self, { tint: 0xFF0000 }, { duration: 200, onFinish: function onFinish() { tween(self, { tint: 0xFFFFFF }, { duration: 200 }); } }); if (self.health <= 0) { LK.showGameOver(); } }; self.heal = function () { if (self.health < self.maxHealth) { self.health++; } }; self.upgradeSpeed = function () { if (self.speed < 10) { self.speed = Math.min(Math.floor(self.speed * 1.15) + 1, 10); } }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerupGraphics = self.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.type = 'health'; // 'health', 'speed', 'score' self.update = function () { self.y += self.speed; self.rotation += 0.05; }; return self; }); var SpeedUpgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('speedUpgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); var SuperEnemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); // Make super enemy larger and different color enemyGraphics.scaleX = 2.0; enemyGraphics.scaleY = 2.0; enemyGraphics.tint = 0x8B0000; // Dark red tint to distinguish from normal enemies self.speed = 3; // Slightly slower than normal enemies self.health = 250; self.maxHealth = 250; self.lastY = 0; self.healthText = new Text2(self.health.toString(), { size: 40, // Larger text for super enemy fill: 0xFFFF00 // Yellow text to stand out }); self.healthText.anchor.set(0.5, 0.5); self.healthText.x = 0; self.healthText.y = -60; // Adjusted for larger size self.addChild(self.healthText); self.takeDamage = function (damage) { self.health -= damage; self.healthText.setText(self.health.toString()); LK.effects.flashObject(self, 0xFFFFFF, 200); if (self.health <= 0) { return true; // Enemy is dead } return false; }; self.update = function () { self.y += self.speed; }; return self; }); var Upgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.attachAsset('upgrade', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.lastY = 0; self.type = 'speed'; // 'speed', 'health', 'firerate', 'damage', 'multishot' self.update = function () { self.y += self.speed; self.rotation += 0.03; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ // Game dimensions and layout - no lanes, full width spawning var gameWidth = 2048; // Create player var player = game.addChild(new Player()); player.x = gameWidth / 2; player.y = 2732 - 200; // Game arrays var enemies = []; var superEnemies = []; var powerups = []; var upgrades = []; var bullets = []; var fireRateUpgrades = []; var healthUpgrades = []; var damageUpgrades = []; var speedUpgrades = []; var multishotUpgrades = []; // Dragging variables var isDragging = false; var dragOffset = { x: 0, y: 0 }; // Game variables var gameSpeed = 1; var enemySpawnRate = 120; var powerupSpawnRate = 180; var upgradeSpawnRate = 300; // UI Elements var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); scoreText.x = 50; scoreText.y = 50; LK.gui.topLeft.addChild(scoreText); var healthText = new Text2('Health: 3', { size: 60, fill: 0xFF0000 }); healthText.anchor.set(1, 0); LK.gui.topRight.addChild(healthText); // Player upgrades display var upgradesText = new Text2('Upgrades:\nDamage: 1\nSpeed: 5\nMultiShot: 1\nFireRate: 30', { size: 40, fill: 0x00FFFF }); upgradesText.anchor.set(1, 0); upgradesText.x = -10; upgradesText.y = 80; LK.gui.topRight.addChild(upgradesText); // Input handling - drag mechanics game.down = function (x, y, obj) { isDragging = true; dragOffset.x = x - player.x; dragOffset.y = y - player.y; }; game.move = function (x, y, obj) { if (isDragging) { player.x = Math.max(50, Math.min(2048 - 50, x - dragOffset.x)); player.y = Math.max(50, Math.min(2732 - 50, y - dragOffset.y)); } }; game.up = function (x, y, obj) { isDragging = false; }; // Main game loop game.update = function () { // Update game speed gameSpeed += 0.001; // Update score and UI scoreText.setText('Score: ' + LK.getScore()); healthText.setText('Health: ' + player.health); upgradesText.setText('Upgrades:\nDamage: ' + player.bulletDamage + '\nSpeed: ' + player.speed + '\nMultiShot: ' + player.multiShot + '\nFireRate: ' + player.fireRate); // Calculate enemy health based on time // Every 30 seconds = 1800 ticks at 60fps (+10 health) // Every 60 seconds = 3600 ticks at 60fps (+20 health) var enemyHealthBonus30s = Math.floor(LK.ticks / 1800) * 10; var enemyHealthBonus60s = Math.floor(LK.ticks / 3600) * 20; var enemyHealthBonus = enemyHealthBonus30s + enemyHealthBonus60s; // Spawn enemies across full width if (LK.ticks % Math.max(30, enemySpawnRate - Math.floor(LK.ticks / 100)) == 0) { var enemy = new Enemy(); enemy.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries enemy.y = -50; enemy.speed = 4 + gameSpeed; enemy.health = 3 + enemyHealthBonus; enemy.maxHealth = 3 + enemyHealthBonus; enemy.healthText.setText(enemy.health.toString()); enemy.lastY = enemy.y; enemies.push(enemy); game.addChild(enemy); } // Spawn super enemies every 2 minutes (7200 ticks at 60fps) if (LK.ticks > 0 && LK.ticks % 7200 == 0) { var superEnemy = new SuperEnemy(); superEnemy.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries superEnemy.y = -50; superEnemy.speed = 3 + gameSpeed * 0.5; // Slower than normal enemies // Calculate super enemy health: 250 base + 250 for each 2-minute interval var superEnemyIntervals = Math.floor(LK.ticks / 7200); superEnemy.health = 250 + superEnemyIntervals * 250; superEnemy.maxHealth = superEnemy.health; superEnemy.healthText.setText(superEnemy.health.toString()); superEnemy.lastY = superEnemy.y; superEnemies.push(superEnemy); game.addChild(superEnemy); } // Spawn powerups across full width (much reduced rate for natural spawns) if (LK.ticks % Math.max(600, powerupSpawnRate * 5 - Math.floor(LK.ticks / 50)) == 0) { var powerup = new PowerUp(); powerup.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries powerup.y = -50; powerup.speed = 6 + gameSpeed; powerup.lastY = powerup.y; powerup.type = Math.random() < 0.7 ? 'health' : 'score'; powerups.push(powerup); game.addChild(powerup); } // Spawn upgrades across full width (much reduced rate for natural spawns) if (LK.ticks % Math.max(1200, upgradeSpawnRate * 5 - Math.floor(LK.ticks / 30)) == 0) { var upgrade = new Upgrade(); upgrade.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries upgrade.y = -50; upgrade.speed = 6 + gameSpeed; upgrade.lastY = upgrade.y; var upgradeTypes = ['speed', 'health', 'firerate', 'damage', 'multishot']; upgrade.type = upgradeTypes[Math.floor(Math.random() * upgradeTypes.length)]; upgrades.push(upgrade); game.addChild(upgrade); } // Spawn fire rate upgrades across full width (much reduced rate for natural spawns) if (LK.ticks % Math.max(1800, 2400 - Math.floor(LK.ticks / 20)) == 0) { var fireRateUpgrade = new FireRateUpgrade(); fireRateUpgrade.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries fireRateUpgrade.y = -50; fireRateUpgrade.speed = 6 + gameSpeed; fireRateUpgrade.lastY = fireRateUpgrade.y; fireRateUpgrades.push(fireRateUpgrade); game.addChild(fireRateUpgrade); } // Auto shooting player.shoot(); // Update and check bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; // Check if bullet went off screen if (bullet.lastY > -50 && bullet.y <= -50) { bullet.destroy(); bullets.splice(i, 1); continue; } bullet.lastY = bullet.y; } // Check bullet-enemy collisions for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.intersects(enemy)) { var enemyDead = enemy.takeDamage(bullet.damage); bullet.destroy(); bullets.splice(i, 1); if (enemyDead) { LK.setScore(LK.getScore() + 1); // Add death animation before destroying enemy tween(enemy, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 200, onFinish: function onFinish() { enemy.destroy(); } }); // Drop upgrade chance when enemy dies - total 80% chance var dropChance = Math.random(); if (dropChance < 0.25 && player.fireRate < 8) { // 25% Fire Rate upgrade (only if fireRate < 8) var droppedUpgrade = new FireRateUpgrade(); droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x)); droppedUpgrade.y = enemy.y; droppedUpgrade.speed = 4; droppedUpgrade.lastY = droppedUpgrade.y; fireRateUpgrades.push(droppedUpgrade); game.addChild(droppedUpgrade); } else if (dropChance < 0.45) { // 20% Damage upgrade var droppedUpgrade = new DamageUpgrade(); droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x)); droppedUpgrade.y = enemy.y; droppedUpgrade.speed = 4; droppedUpgrade.lastY = droppedUpgrade.y; damageUpgrades.push(droppedUpgrade); game.addChild(droppedUpgrade); } else if (dropChance < 0.65 && player.speed < 10) { // 20% Speed upgrade (only if speed < 10) var droppedUpgrade = new SpeedUpgrade(); droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x)); droppedUpgrade.y = enemy.y; droppedUpgrade.speed = 4; droppedUpgrade.lastY = droppedUpgrade.y; speedUpgrades.push(droppedUpgrade); game.addChild(droppedUpgrade); } else if (dropChance < 0.75) { // 10% Multishot upgrade var droppedUpgrade = new MultishotUpgrade(); droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x)); droppedUpgrade.y = enemy.y; droppedUpgrade.speed = 4; droppedUpgrade.lastY = droppedUpgrade.y; multishotUpgrades.push(droppedUpgrade); game.addChild(droppedUpgrade); } else if (dropChance < 0.80) { // 5% Health upgrade var droppedUpgrade = new HealthUpgrade(); droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x)); droppedUpgrade.y = enemy.y; droppedUpgrade.speed = 4; droppedUpgrade.lastY = droppedUpgrade.y; healthUpgrades.push(droppedUpgrade); game.addChild(droppedUpgrade); } enemies.splice(j, 1); } break; } } } // Check bullet-superEnemy collisions for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; for (var j = superEnemies.length - 1; j >= 0; j--) { var superEnemy = superEnemies[j]; if (bullet.intersects(superEnemy)) { var superEnemyDead = superEnemy.takeDamage(bullet.damage); bullet.destroy(); bullets.splice(i, 1); if (superEnemyDead) { LK.setScore(LK.getScore() + 50); // More points for super enemy // Add death animation before destroying super enemy tween(superEnemy, { alpha: 0, scaleX: 1.5, scaleY: 1.5 }, { duration: 300, onFinish: function onFinish() { superEnemy.destroy(); } }); // Super enemies always drop multiple upgrades if (player.fireRate < 8) { var droppedUpgrade1 = new FireRateUpgrade(); droppedUpgrade1.x = Math.max(25, Math.min(gameWidth - 25, superEnemy.x - 30)); droppedUpgrade1.y = superEnemy.y; droppedUpgrade1.speed = 4; droppedUpgrade1.lastY = droppedUpgrade1.y; fireRateUpgrades.push(droppedUpgrade1); game.addChild(droppedUpgrade1); } var droppedUpgrade2 = new DamageUpgrade(); droppedUpgrade2.x = Math.max(25, Math.min(gameWidth - 25, superEnemy.x + 30)); droppedUpgrade2.y = superEnemy.y; droppedUpgrade2.speed = 4; droppedUpgrade2.lastY = droppedUpgrade2.y; damageUpgrades.push(droppedUpgrade2); game.addChild(droppedUpgrade2); superEnemies.splice(j, 1); } break; } } } // Update and check enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; // Check if enemy went off screen if (enemy.lastY < 2732 + 50 && enemy.y >= 2732 + 50) { player.takeDamage(); // Player takes damage when enemy reaches bottom enemy.destroy(); enemies.splice(i, 1); continue; } // Check collision with player if (enemy.intersects(player)) { player.takeDamage(); enemy.destroy(); enemies.splice(i, 1); continue; } enemy.lastY = enemy.y; } // Update and check super enemies for (var i = superEnemies.length - 1; i >= 0; i--) { var superEnemy = superEnemies[i]; // Check if super enemy went off screen if (superEnemy.lastY < 2732 + 50 && superEnemy.y >= 2732 + 50) { player.takeDamage(); // Player takes damage when super enemy reaches bottom superEnemy.destroy(); superEnemies.splice(i, 1); continue; } // Check collision with player if (superEnemy.intersects(player)) { player.takeDamage(); player.takeDamage(); // Super enemies deal double damage superEnemy.destroy(); superEnemies.splice(i, 1); continue; } superEnemy.lastY = superEnemy.y; } // Update and check powerups for (var i = powerups.length - 1; i >= 0; i--) { var powerup = powerups[i]; // Check if powerup went off screen if (powerup.lastY < 2732 + 50 && powerup.y >= 2732 + 50) { powerup.destroy(); powerups.splice(i, 1); continue; } // Check collection by player if (powerup.intersects(player)) { LK.getSound('collect').play(); if (powerup.type === 'health') { player.heal(); } else if (powerup.type === 'score') { LK.setScore(LK.getScore() + 10); } // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(powerup, 0xFFFFFF, 200); powerup.destroy(); powerups.splice(i, 1); continue; } powerup.lastY = powerup.y; } // Update and check upgrades for (var i = upgrades.length - 1; i >= 0; i--) { var upgrade = upgrades[i]; // Check if upgrade went off screen if (upgrade.lastY < 2732 + 50 && upgrade.y >= 2732 + 50) { upgrade.destroy(); upgrades.splice(i, 1); continue; } // Check collection by player if (upgrade.intersects(player)) { LK.getSound('collect').play(); if (upgrade.type === 'speed') { player.upgradeSpeed(); } else if (upgrade.type === 'health') { player.maxHealth = Math.floor(player.maxHealth * 1.2) + 1; player.health = player.maxHealth; } else if (upgrade.type === 'firerate') { player.upgradeFireRate(); } else if (upgrade.type === 'damage') { player.upgradeDamage(); } else if (upgrade.type === 'multishot') { player.upgradeMultiShot(); } // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(upgrade, 0x00FF00, 300); upgrade.destroy(); upgrades.splice(i, 1); continue; } upgrade.lastY = upgrade.y; } // Update and check fire rate upgrades for (var i = fireRateUpgrades.length - 1; i >= 0; i--) { var fireRateUpgrade = fireRateUpgrades[i]; // Check if upgrade went off screen if (fireRateUpgrade.lastY < 2732 + 50 && fireRateUpgrade.y >= 2732 + 50) { fireRateUpgrade.destroy(); fireRateUpgrades.splice(i, 1); continue; } // Check collection by player if (fireRateUpgrade.intersects(player)) { LK.getSound('collect').play(); player.upgradeFireRate(); // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(fireRateUpgrade, 0xffa500, 300); fireRateUpgrade.destroy(); fireRateUpgrades.splice(i, 1); continue; } fireRateUpgrade.lastY = fireRateUpgrade.y; } // Update and check damage upgrades for (var i = damageUpgrades.length - 1; i >= 0; i--) { var damageUpgrade = damageUpgrades[i]; // Check if upgrade went off screen if (damageUpgrade.lastY < 2732 + 50 && damageUpgrade.y >= 2732 + 50) { damageUpgrade.destroy(); damageUpgrades.splice(i, 1); continue; } // Check collection by player if (damageUpgrade.intersects(player)) { LK.getSound('collect').play(); player.upgradeDamage(); // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(damageUpgrade, 0xffff00, 300); damageUpgrade.destroy(); damageUpgrades.splice(i, 1); continue; } damageUpgrade.lastY = damageUpgrade.y; } // Update and check speed upgrades for (var i = speedUpgrades.length - 1; i >= 0; i--) { var speedUpgrade = speedUpgrades[i]; // Check if upgrade went off screen if (speedUpgrade.lastY < 2732 + 50 && speedUpgrade.y >= 2732 + 50) { speedUpgrade.destroy(); speedUpgrades.splice(i, 1); continue; } // Check collection by player if (speedUpgrade.intersects(player)) { LK.getSound('collect').play(); player.upgradeSpeed(); // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(speedUpgrade, 0x0000ff, 300); speedUpgrade.destroy(); speedUpgrades.splice(i, 1); continue; } speedUpgrade.lastY = speedUpgrade.y; } // Update and check multishot upgrades for (var i = multishotUpgrades.length - 1; i >= 0; i--) { var multishotUpgrade = multishotUpgrades[i]; // Check if upgrade went off screen if (multishotUpgrade.lastY < 2732 + 50 && multishotUpgrade.y >= 2732 + 50) { multishotUpgrade.destroy(); multishotUpgrades.splice(i, 1); continue; } // Check collection by player if (multishotUpgrade.intersects(player)) { LK.getSound('collect').play(); player.upgradeMultiShot(); // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(multishotUpgrade, 0x800000, 300); multishotUpgrade.destroy(); multishotUpgrades.splice(i, 1); continue; } multishotUpgrade.lastY = multishotUpgrade.y; } // Update and check health upgrades for (var i = healthUpgrades.length - 1; i >= 0; i--) { var healthUpgrade = healthUpgrades[i]; // Check if upgrade went off screen if (healthUpgrade.lastY < 2732 + 50 && healthUpgrade.y >= 2732 + 50) { healthUpgrade.destroy(); healthUpgrades.splice(i, 1); continue; } // Check collection by player if (healthUpgrade.intersects(player)) { LK.getSound('collect').play(); player.maxHealth = Math.floor(player.maxHealth * 1.2) + 1; player.health = player.maxHealth; // Add player upgrade animation tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); LK.effects.flashObject(healthUpgrade, 0x4caf50, 300); healthUpgrade.destroy(); healthUpgrades.splice(i, 1); continue; } healthUpgrade.lastY = healthUpgrade.y; } }; // Start background music LK.playMusic('background');
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.damage = 1;
self.lastY = 0;
self.update = function () {
self.y -= self.speed;
};
return self;
});
var DamageUpgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('damageUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 4;
self.health = 3;
self.maxHealth = 3;
self.lastY = 0;
self.healthText = new Text2(self.health.toString(), {
size: 30,
fill: 0xFFFFFF
});
self.healthText.anchor.set(0.5, 0.5);
self.healthText.x = 0;
self.healthText.y = -40;
self.addChild(self.healthText);
self.takeDamage = function (damage) {
self.health -= damage;
self.healthText.setText(self.health.toString());
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
return true; // Enemy is dead
}
return false;
};
self.update = function () {
self.y += self.speed;
};
return self;
});
var FireRateUpgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('fireRateUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
var HealthUpgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('healthUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
var MultishotUpgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('multishotUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 3;
self.maxHealth = 3;
self.speed = 5;
self.fireRate = 1; // Start at 1 and increment up
self.bulletDamage = 1;
self.multiShot = 1; // Number of bullets per shot
self.lastShot = 0;
self.shoot = function () {
if (LK.ticks - self.lastShot >= Math.floor(60 / self.fireRate)) {
self.lastShot = LK.ticks;
LK.getSound('shoot').play();
for (var i = 0; i < self.multiShot; i++) {
var bullet = new Bullet();
bullet.x = self.x + (i - (self.multiShot - 1) / 2) * 20;
bullet.y = self.y - 40;
bullet.damage = self.bulletDamage;
bullet.lastY = bullet.y;
bullets.push(bullet);
game.addChild(bullet);
}
}
};
self.upgradeFireRate = function () {
if (self.fireRate < 8) {
self.fireRate += 1;
}
};
self.upgradeDamage = function () {
self.bulletDamage += 1;
};
self.upgradeMultiShot = function () {
if (self.multiShot >= 5) {
// Reset multishot to 1 and add 3 damage
self.multiShot = 1;
self.bulletDamage += 3;
} else {
self.multiShot += 1;
}
};
self.takeDamage = function () {
self.health--;
LK.getSound('damage').play();
// Add red tint animation to player
tween(self, {
tint: 0xFF0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(self, {
tint: 0xFFFFFF
}, {
duration: 200
});
}
});
if (self.health <= 0) {
LK.showGameOver();
}
};
self.heal = function () {
if (self.health < self.maxHealth) {
self.health++;
}
};
self.upgradeSpeed = function () {
if (self.speed < 10) {
self.speed = Math.min(Math.floor(self.speed * 1.15) + 1, 10);
}
};
return self;
});
var PowerUp = Container.expand(function () {
var self = Container.call(this);
var powerupGraphics = self.attachAsset('powerup', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.type = 'health'; // 'health', 'speed', 'score'
self.update = function () {
self.y += self.speed;
self.rotation += 0.05;
};
return self;
});
var SpeedUpgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('speedUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
var SuperEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
// Make super enemy larger and different color
enemyGraphics.scaleX = 2.0;
enemyGraphics.scaleY = 2.0;
enemyGraphics.tint = 0x8B0000; // Dark red tint to distinguish from normal enemies
self.speed = 3; // Slightly slower than normal enemies
self.health = 250;
self.maxHealth = 250;
self.lastY = 0;
self.healthText = new Text2(self.health.toString(), {
size: 40,
// Larger text for super enemy
fill: 0xFFFF00 // Yellow text to stand out
});
self.healthText.anchor.set(0.5, 0.5);
self.healthText.x = 0;
self.healthText.y = -60; // Adjusted for larger size
self.addChild(self.healthText);
self.takeDamage = function (damage) {
self.health -= damage;
self.healthText.setText(self.health.toString());
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
return true; // Enemy is dead
}
return false;
};
self.update = function () {
self.y += self.speed;
};
return self;
});
var Upgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('upgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.lastY = 0;
self.type = 'speed'; // 'speed', 'health', 'firerate', 'damage', 'multishot'
self.update = function () {
self.y += self.speed;
self.rotation += 0.03;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Game dimensions and layout - no lanes, full width spawning
var gameWidth = 2048;
// Create player
var player = game.addChild(new Player());
player.x = gameWidth / 2;
player.y = 2732 - 200;
// Game arrays
var enemies = [];
var superEnemies = [];
var powerups = [];
var upgrades = [];
var bullets = [];
var fireRateUpgrades = [];
var healthUpgrades = [];
var damageUpgrades = [];
var speedUpgrades = [];
var multishotUpgrades = [];
// Dragging variables
var isDragging = false;
var dragOffset = {
x: 0,
y: 0
};
// Game variables
var gameSpeed = 1;
var enemySpawnRate = 120;
var powerupSpawnRate = 180;
var upgradeSpawnRate = 300;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 50;
scoreText.y = 50;
LK.gui.topLeft.addChild(scoreText);
var healthText = new Text2('Health: 3', {
size: 60,
fill: 0xFF0000
});
healthText.anchor.set(1, 0);
LK.gui.topRight.addChild(healthText);
// Player upgrades display
var upgradesText = new Text2('Upgrades:\nDamage: 1\nSpeed: 5\nMultiShot: 1\nFireRate: 30', {
size: 40,
fill: 0x00FFFF
});
upgradesText.anchor.set(1, 0);
upgradesText.x = -10;
upgradesText.y = 80;
LK.gui.topRight.addChild(upgradesText);
// Input handling - drag mechanics
game.down = function (x, y, obj) {
isDragging = true;
dragOffset.x = x - player.x;
dragOffset.y = y - player.y;
};
game.move = function (x, y, obj) {
if (isDragging) {
player.x = Math.max(50, Math.min(2048 - 50, x - dragOffset.x));
player.y = Math.max(50, Math.min(2732 - 50, y - dragOffset.y));
}
};
game.up = function (x, y, obj) {
isDragging = false;
};
// Main game loop
game.update = function () {
// Update game speed
gameSpeed += 0.001;
// Update score and UI
scoreText.setText('Score: ' + LK.getScore());
healthText.setText('Health: ' + player.health);
upgradesText.setText('Upgrades:\nDamage: ' + player.bulletDamage + '\nSpeed: ' + player.speed + '\nMultiShot: ' + player.multiShot + '\nFireRate: ' + player.fireRate);
// Calculate enemy health based on time
// Every 30 seconds = 1800 ticks at 60fps (+10 health)
// Every 60 seconds = 3600 ticks at 60fps (+20 health)
var enemyHealthBonus30s = Math.floor(LK.ticks / 1800) * 10;
var enemyHealthBonus60s = Math.floor(LK.ticks / 3600) * 20;
var enemyHealthBonus = enemyHealthBonus30s + enemyHealthBonus60s;
// Spawn enemies across full width
if (LK.ticks % Math.max(30, enemySpawnRate - Math.floor(LK.ticks / 100)) == 0) {
var enemy = new Enemy();
enemy.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries
enemy.y = -50;
enemy.speed = 4 + gameSpeed;
enemy.health = 3 + enemyHealthBonus;
enemy.maxHealth = 3 + enemyHealthBonus;
enemy.healthText.setText(enemy.health.toString());
enemy.lastY = enemy.y;
enemies.push(enemy);
game.addChild(enemy);
}
// Spawn super enemies every 2 minutes (7200 ticks at 60fps)
if (LK.ticks > 0 && LK.ticks % 7200 == 0) {
var superEnemy = new SuperEnemy();
superEnemy.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries
superEnemy.y = -50;
superEnemy.speed = 3 + gameSpeed * 0.5; // Slower than normal enemies
// Calculate super enemy health: 250 base + 250 for each 2-minute interval
var superEnemyIntervals = Math.floor(LK.ticks / 7200);
superEnemy.health = 250 + superEnemyIntervals * 250;
superEnemy.maxHealth = superEnemy.health;
superEnemy.healthText.setText(superEnemy.health.toString());
superEnemy.lastY = superEnemy.y;
superEnemies.push(superEnemy);
game.addChild(superEnemy);
}
// Spawn powerups across full width (much reduced rate for natural spawns)
if (LK.ticks % Math.max(600, powerupSpawnRate * 5 - Math.floor(LK.ticks / 50)) == 0) {
var powerup = new PowerUp();
powerup.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries
powerup.y = -50;
powerup.speed = 6 + gameSpeed;
powerup.lastY = powerup.y;
powerup.type = Math.random() < 0.7 ? 'health' : 'score';
powerups.push(powerup);
game.addChild(powerup);
}
// Spawn upgrades across full width (much reduced rate for natural spawns)
if (LK.ticks % Math.max(1200, upgradeSpawnRate * 5 - Math.floor(LK.ticks / 30)) == 0) {
var upgrade = new Upgrade();
upgrade.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries
upgrade.y = -50;
upgrade.speed = 6 + gameSpeed;
upgrade.lastY = upgrade.y;
var upgradeTypes = ['speed', 'health', 'firerate', 'damage', 'multishot'];
upgrade.type = upgradeTypes[Math.floor(Math.random() * upgradeTypes.length)];
upgrades.push(upgrade);
game.addChild(upgrade);
}
// Spawn fire rate upgrades across full width (much reduced rate for natural spawns)
if (LK.ticks % Math.max(1800, 2400 - Math.floor(LK.ticks / 20)) == 0) {
var fireRateUpgrade = new FireRateUpgrade();
fireRateUpgrade.x = 25 + Math.random() * (gameWidth - 50); // Random position with 25px boundaries
fireRateUpgrade.y = -50;
fireRateUpgrade.speed = 6 + gameSpeed;
fireRateUpgrade.lastY = fireRateUpgrade.y;
fireRateUpgrades.push(fireRateUpgrade);
game.addChild(fireRateUpgrade);
}
// Auto shooting
player.shoot();
// Update and check bullets
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
// Check if bullet went off screen
if (bullet.lastY > -50 && bullet.y <= -50) {
bullet.destroy();
bullets.splice(i, 1);
continue;
}
bullet.lastY = bullet.y;
}
// Check bullet-enemy collisions
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
for (var j = enemies.length - 1; j >= 0; j--) {
var enemy = enemies[j];
if (bullet.intersects(enemy)) {
var enemyDead = enemy.takeDamage(bullet.damage);
bullet.destroy();
bullets.splice(i, 1);
if (enemyDead) {
LK.setScore(LK.getScore() + 1);
// Add death animation before destroying enemy
tween(enemy, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 200,
onFinish: function onFinish() {
enemy.destroy();
}
});
// Drop upgrade chance when enemy dies - total 80% chance
var dropChance = Math.random();
if (dropChance < 0.25 && player.fireRate < 8) {
// 25% Fire Rate upgrade (only if fireRate < 8)
var droppedUpgrade = new FireRateUpgrade();
droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x));
droppedUpgrade.y = enemy.y;
droppedUpgrade.speed = 4;
droppedUpgrade.lastY = droppedUpgrade.y;
fireRateUpgrades.push(droppedUpgrade);
game.addChild(droppedUpgrade);
} else if (dropChance < 0.45) {
// 20% Damage upgrade
var droppedUpgrade = new DamageUpgrade();
droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x));
droppedUpgrade.y = enemy.y;
droppedUpgrade.speed = 4;
droppedUpgrade.lastY = droppedUpgrade.y;
damageUpgrades.push(droppedUpgrade);
game.addChild(droppedUpgrade);
} else if (dropChance < 0.65 && player.speed < 10) {
// 20% Speed upgrade (only if speed < 10)
var droppedUpgrade = new SpeedUpgrade();
droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x));
droppedUpgrade.y = enemy.y;
droppedUpgrade.speed = 4;
droppedUpgrade.lastY = droppedUpgrade.y;
speedUpgrades.push(droppedUpgrade);
game.addChild(droppedUpgrade);
} else if (dropChance < 0.75) {
// 10% Multishot upgrade
var droppedUpgrade = new MultishotUpgrade();
droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x));
droppedUpgrade.y = enemy.y;
droppedUpgrade.speed = 4;
droppedUpgrade.lastY = droppedUpgrade.y;
multishotUpgrades.push(droppedUpgrade);
game.addChild(droppedUpgrade);
} else if (dropChance < 0.80) {
// 5% Health upgrade
var droppedUpgrade = new HealthUpgrade();
droppedUpgrade.x = Math.max(25, Math.min(gameWidth - 25, enemy.x));
droppedUpgrade.y = enemy.y;
droppedUpgrade.speed = 4;
droppedUpgrade.lastY = droppedUpgrade.y;
healthUpgrades.push(droppedUpgrade);
game.addChild(droppedUpgrade);
}
enemies.splice(j, 1);
}
break;
}
}
}
// Check bullet-superEnemy collisions
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
for (var j = superEnemies.length - 1; j >= 0; j--) {
var superEnemy = superEnemies[j];
if (bullet.intersects(superEnemy)) {
var superEnemyDead = superEnemy.takeDamage(bullet.damage);
bullet.destroy();
bullets.splice(i, 1);
if (superEnemyDead) {
LK.setScore(LK.getScore() + 50); // More points for super enemy
// Add death animation before destroying super enemy
tween(superEnemy, {
alpha: 0,
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 300,
onFinish: function onFinish() {
superEnemy.destroy();
}
});
// Super enemies always drop multiple upgrades
if (player.fireRate < 8) {
var droppedUpgrade1 = new FireRateUpgrade();
droppedUpgrade1.x = Math.max(25, Math.min(gameWidth - 25, superEnemy.x - 30));
droppedUpgrade1.y = superEnemy.y;
droppedUpgrade1.speed = 4;
droppedUpgrade1.lastY = droppedUpgrade1.y;
fireRateUpgrades.push(droppedUpgrade1);
game.addChild(droppedUpgrade1);
}
var droppedUpgrade2 = new DamageUpgrade();
droppedUpgrade2.x = Math.max(25, Math.min(gameWidth - 25, superEnemy.x + 30));
droppedUpgrade2.y = superEnemy.y;
droppedUpgrade2.speed = 4;
droppedUpgrade2.lastY = droppedUpgrade2.y;
damageUpgrades.push(droppedUpgrade2);
game.addChild(droppedUpgrade2);
superEnemies.splice(j, 1);
}
break;
}
}
}
// Update and check enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
// Check if enemy went off screen
if (enemy.lastY < 2732 + 50 && enemy.y >= 2732 + 50) {
player.takeDamage(); // Player takes damage when enemy reaches bottom
enemy.destroy();
enemies.splice(i, 1);
continue;
}
// Check collision with player
if (enemy.intersects(player)) {
player.takeDamage();
enemy.destroy();
enemies.splice(i, 1);
continue;
}
enemy.lastY = enemy.y;
}
// Update and check super enemies
for (var i = superEnemies.length - 1; i >= 0; i--) {
var superEnemy = superEnemies[i];
// Check if super enemy went off screen
if (superEnemy.lastY < 2732 + 50 && superEnemy.y >= 2732 + 50) {
player.takeDamage(); // Player takes damage when super enemy reaches bottom
superEnemy.destroy();
superEnemies.splice(i, 1);
continue;
}
// Check collision with player
if (superEnemy.intersects(player)) {
player.takeDamage();
player.takeDamage(); // Super enemies deal double damage
superEnemy.destroy();
superEnemies.splice(i, 1);
continue;
}
superEnemy.lastY = superEnemy.y;
}
// Update and check powerups
for (var i = powerups.length - 1; i >= 0; i--) {
var powerup = powerups[i];
// Check if powerup went off screen
if (powerup.lastY < 2732 + 50 && powerup.y >= 2732 + 50) {
powerup.destroy();
powerups.splice(i, 1);
continue;
}
// Check collection by player
if (powerup.intersects(player)) {
LK.getSound('collect').play();
if (powerup.type === 'health') {
player.heal();
} else if (powerup.type === 'score') {
LK.setScore(LK.getScore() + 10);
}
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(powerup, 0xFFFFFF, 200);
powerup.destroy();
powerups.splice(i, 1);
continue;
}
powerup.lastY = powerup.y;
}
// Update and check upgrades
for (var i = upgrades.length - 1; i >= 0; i--) {
var upgrade = upgrades[i];
// Check if upgrade went off screen
if (upgrade.lastY < 2732 + 50 && upgrade.y >= 2732 + 50) {
upgrade.destroy();
upgrades.splice(i, 1);
continue;
}
// Check collection by player
if (upgrade.intersects(player)) {
LK.getSound('collect').play();
if (upgrade.type === 'speed') {
player.upgradeSpeed();
} else if (upgrade.type === 'health') {
player.maxHealth = Math.floor(player.maxHealth * 1.2) + 1;
player.health = player.maxHealth;
} else if (upgrade.type === 'firerate') {
player.upgradeFireRate();
} else if (upgrade.type === 'damage') {
player.upgradeDamage();
} else if (upgrade.type === 'multishot') {
player.upgradeMultiShot();
}
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(upgrade, 0x00FF00, 300);
upgrade.destroy();
upgrades.splice(i, 1);
continue;
}
upgrade.lastY = upgrade.y;
}
// Update and check fire rate upgrades
for (var i = fireRateUpgrades.length - 1; i >= 0; i--) {
var fireRateUpgrade = fireRateUpgrades[i];
// Check if upgrade went off screen
if (fireRateUpgrade.lastY < 2732 + 50 && fireRateUpgrade.y >= 2732 + 50) {
fireRateUpgrade.destroy();
fireRateUpgrades.splice(i, 1);
continue;
}
// Check collection by player
if (fireRateUpgrade.intersects(player)) {
LK.getSound('collect').play();
player.upgradeFireRate();
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(fireRateUpgrade, 0xffa500, 300);
fireRateUpgrade.destroy();
fireRateUpgrades.splice(i, 1);
continue;
}
fireRateUpgrade.lastY = fireRateUpgrade.y;
}
// Update and check damage upgrades
for (var i = damageUpgrades.length - 1; i >= 0; i--) {
var damageUpgrade = damageUpgrades[i];
// Check if upgrade went off screen
if (damageUpgrade.lastY < 2732 + 50 && damageUpgrade.y >= 2732 + 50) {
damageUpgrade.destroy();
damageUpgrades.splice(i, 1);
continue;
}
// Check collection by player
if (damageUpgrade.intersects(player)) {
LK.getSound('collect').play();
player.upgradeDamage();
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(damageUpgrade, 0xffff00, 300);
damageUpgrade.destroy();
damageUpgrades.splice(i, 1);
continue;
}
damageUpgrade.lastY = damageUpgrade.y;
}
// Update and check speed upgrades
for (var i = speedUpgrades.length - 1; i >= 0; i--) {
var speedUpgrade = speedUpgrades[i];
// Check if upgrade went off screen
if (speedUpgrade.lastY < 2732 + 50 && speedUpgrade.y >= 2732 + 50) {
speedUpgrade.destroy();
speedUpgrades.splice(i, 1);
continue;
}
// Check collection by player
if (speedUpgrade.intersects(player)) {
LK.getSound('collect').play();
player.upgradeSpeed();
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(speedUpgrade, 0x0000ff, 300);
speedUpgrade.destroy();
speedUpgrades.splice(i, 1);
continue;
}
speedUpgrade.lastY = speedUpgrade.y;
}
// Update and check multishot upgrades
for (var i = multishotUpgrades.length - 1; i >= 0; i--) {
var multishotUpgrade = multishotUpgrades[i];
// Check if upgrade went off screen
if (multishotUpgrade.lastY < 2732 + 50 && multishotUpgrade.y >= 2732 + 50) {
multishotUpgrade.destroy();
multishotUpgrades.splice(i, 1);
continue;
}
// Check collection by player
if (multishotUpgrade.intersects(player)) {
LK.getSound('collect').play();
player.upgradeMultiShot();
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(multishotUpgrade, 0x800000, 300);
multishotUpgrade.destroy();
multishotUpgrades.splice(i, 1);
continue;
}
multishotUpgrade.lastY = multishotUpgrade.y;
}
// Update and check health upgrades
for (var i = healthUpgrades.length - 1; i >= 0; i--) {
var healthUpgrade = healthUpgrades[i];
// Check if upgrade went off screen
if (healthUpgrade.lastY < 2732 + 50 && healthUpgrade.y >= 2732 + 50) {
healthUpgrade.destroy();
healthUpgrades.splice(i, 1);
continue;
}
// Check collection by player
if (healthUpgrade.intersects(player)) {
LK.getSound('collect').play();
player.maxHealth = Math.floor(player.maxHealth * 1.2) + 1;
player.health = player.maxHealth;
// Add player upgrade animation
tween(player, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
onFinish: function onFinish() {
tween(player, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150
});
}
});
LK.effects.flashObject(healthUpgrade, 0x4caf50, 300);
healthUpgrade.destroy();
healthUpgrades.splice(i, 1);
continue;
}
healthUpgrade.lastY = healthUpgrade.y;
}
};
// Start background music
LK.playMusic('background');
Aşırı kızgın, hatta kafasından alevler çıkan, kübizm tarzında bir canavar çiz.. In-Game asset. 2d. High contrast. No shadows
kübizm tarzında düz bir mermi. In-Game asset. 2d. High contrast. No shadows
Aşırı kızgın, kübizm tarzında bir canavar çiz.. In-Game asset. 2d. High contrast. No shadows
Bir iyileşme efekti çiz kübizm tarzında. In-Game asset. 2d. High contrast. No shadows
Ortaçağ tarzında bir uzay gemisi çiz ve çizim tarzıda kübizm olsun. In-Game asset. 2d. High contrast. No shadows
Bir iyileşme efekti çiz sade olsun In-Game asset. 2d. High contrast. No shadows
saldırı hızını artışını gösteren bir çizim In-Game asset. 2d. High contrast. No shadows
hız artışını görselleştir ve mavi olsun In-Game asset. 2d. High contrast. No shadows
Birden fazla mermi, üzerinde + işareti olsun ve mavi olsun In-Game asset. 2d. High contrast. No shadows
Kaslı bir kol üstünde de + işareti olan bir çizim yap mavi olsun In-Game asset. 2d. High contrast. No shadows
Tekrar eden başlangıç ve son noktası aynı olan bir uzay arkaplan olarak yapmak istiyorum In-Game asset. 2d. High contrast.