User prompt
Add 99 more super really annoying and super annoying and really funny bugs. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make super annoying noises going off every 0000.000.001 seconds
User prompt
Make a flash that hurts the player’s eyes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add a SUPER funny jumpscare every 30 seconds
User prompt
Make random ads advertising to go to McDonald’s to go to Walmart and to eat a banana.
User prompt
Make it less laggy and make it flash colors and and the screen spins so fast for 4 seconds and add 5 more ridiculously funny bugs. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add a SUPER SUPER SUPER FUNNY JUMPSCARE AND ADD 32 more Hilarious super funny super Duper snooper so funny super Duper funny, super Duper funny, funny, unbelievably funny bugs
User prompt
Make it where the game can’t lag and if it does it keeps going and it doesn’t lag
User prompt
Make it where the player can’t die
User prompt
Add 21 more super super super super super super Duper super super hilarious super super snooper ∞ Amount funny super funny bugs.
User prompt
Fix the bug Compilation error[L1135]: Timeout.tick error: null is not an object (evaluating 'player.canShoot = true')
User prompt
Please fix the bug: 'Timeout.tick error: null is not an object (evaluating 'player.canShoot = true')' in or related to this line: 'player.canShoot = true;' Line Number: 1135
User prompt
Add 21 more super super super super super super Duper super super hilarious super super snooper ∞ Amount funny super funny bugs.
User prompt
Add 12 more hilarious super funny bugs
User prompt
Remove the thing where if you shoot the asteroid you don’t win
User prompt
Add 5 more bugs and remove the bug where enemylaser doesn’t shoot so fast.
User prompt
And make it where if the game lags non stop the game reloads and you losee
User prompt
Make it where if the game lags the game resets the screen turns black And the Aguhhhhh asset goes in the middle of the screen.
User prompt
When the aguhhhhh asset goes in the middle of the screen make it big and make all the enemylaser disappear.
User prompt
Make it where if the game lags the game resets the screen turns black And the Aguhhhhh asset goes in the middle of the screen.
User prompt
Add a bug where the enemylaser shoots so fast and shoots in different directions non-stop
User prompt
And 12 silly bugs
User prompt
Add silly bugs
User prompt
Fix all bugs :p
User prompt
Make it where if the player get hit by enemylaser player becomes deadship and when you get hit by enemylaser you also drop a 90¢ coin and then you lose the game.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0 }); /**** * Classes ****/ var Asteroid = Container.expand(function () { var self = Container.call(this); var asteroid = self.attachAsset('asteroid', { anchorX: 0.5, anchorY: 0.5 }); self.health = 2; self.speed = { y: 2 + Math.random() * 2, x: (Math.random() - 0.5) * 2 }; self.rotation = Math.random() * 0.1 - 0.05; self.scoreValue = 15; // Random size variation var scale = 0.7 + Math.random() * 0.8; asteroid.scale.set(scale, scale); self.damage = function (amount) { self.health -= amount || 1; tween(asteroid, { tint: 0xffffff }, { duration: 200, onFinish: function onFinish() { asteroid.tint = 0x95a5a6; } }); // Randomly start advertising products when damaged if (Math.random() < 0.4) { var ads = ['BUY SPACE INSURANCE!', 'HOT SINGLES IN YOUR GALAXY!', 'CLICK HERE FOR FREE ROBUX!', 'ENLARGED YOUR SPACESHIP!', 'LOSE WEIGHT WITH THIS TRICK!', 'DOCTORS HATE THIS ASTEROID!']; var adText = new Text2(ads[Math.floor(Math.random() * ads.length)], { size: 25, fill: 0x00FFFF }); adText.anchor.set(0.5, 0.5); adText.x = self.x; adText.y = self.y - 60; self.parent.addChild(adText); tween(adText, { alpha: 0, y: adText.y - 80, rotation: Math.PI }, { duration: 3000, onFinish: function onFinish() { adText.destroy(); } }); } return self.health <= 0; }; self.update = function () { self.y += self.speed.y; self.x += self.speed.x; asteroid.rotation += self.rotation; // Randomly become invisible/visible if (Math.random() < 0.05) { asteroid.alpha = asteroid.alpha > 0.5 ? 0.1 : 1; } // Randomly tell jokes if (Math.random() < 0.003) { var jokes = ['Why did the asteroid break up? It needed SPACE!', 'I ROCK!', 'METEOR you later!', 'COMET me bro!', 'I have a ROCKY personality']; var jokeText = new Text2(jokes[Math.floor(Math.random() * jokes.length)], { size: 30, fill: 0x00FF00 }); jokeText.anchor.set(0.5, 0.5); jokeText.x = self.x; jokeText.y = self.y - 50; self.parent.addChild(jokeText); tween(jokeText, { alpha: 0, y: jokeText.y - 100 }, { duration: 3000, onFinish: function onFinish() { jokeText.destroy(); } }); } // Randomly turn into disco balls and start party mode if (Math.random() < 0.006) { asteroid.tint = Math.random() * 0xffffff; asteroid.rotation += 0.3; // Create disco lights for (var disco = 0; disco < 8; disco++) { var discoLight = self.parent.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); var angle = disco / 8 * Math.PI * 2; discoLight.x = self.x + Math.cos(angle) * 80; discoLight.y = self.y + Math.sin(angle) * 80; discoLight.scale.set(0.3, 0.3); discoLight.tint = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF][disco % 6]; tween(discoLight, { alpha: 0, rotation: Math.PI * 2 }, { duration: 2000, onFinish: function onFinish() { discoLight.destroy(); } }); } var partyText = new Text2('🕺 PARTY TIME! 💃', { size: 40, fill: 0xFF1493 }); partyText.anchor.set(0.5, 0.5); partyText.x = self.x; partyText.y = self.y - 100; self.parent.addChild(partyText); tween(partyText, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 3000, onFinish: function onFinish() { partyText.destroy(); } }); LK.playMusic('gameMusic'); } }; return self; }); var Boss = Container.expand(function (level) { var self = Container.call(this); var ship = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.level = level || 1; self.maxHealth = 20 * self.level; self.health = self.maxHealth; self.scoreValue = 200 * self.level; self.phase = 0; self.phaseTime = 0; self.patterns = ['side-to-side', 'charge', 'retreat']; self.currentPattern = 0; self.targetX = 0; self.targetY = 0; // Adjust boss based on level if (self.level > 1) { ship.tint = 0xcc00cc; } // Health bar self.healthBar = new Container(); self.addChild(self.healthBar); var healthBarBg = self.healthBar.attachAsset('playerLaser', { anchorX: 0, anchorY: 0.5, scaleX: 2, scaleY: 0.5 }); healthBarBg.tint = 0x333333; healthBarBg.width = 200; self.healthBarFill = self.healthBar.attachAsset('playerLaser', { anchorX: 0, anchorY: 0.5, scaleX: 2, scaleY: 0.4 }); self.healthBarFill.tint = 0xff3333; self.healthBarFill.width = 200; self.healthBar.y = -120; self.damage = function (amount) { self.health -= amount || 1; // Update health bar - show completely wrong values var wrongHealthValues = [-0.5, 2.5, 100, 0.01, 999]; var healthPercent = wrongHealthValues[Math.floor(Math.random() * wrongHealthValues.length)]; self.healthBarFill.width = 200 * Math.abs(healthPercent); if (healthPercent < 0) self.healthBarFill.tint = 0x00ff00; // Green when negative tween(ship, { tint: 0xffffff }, { duration: 100, onFinish: function onFinish() { ship.tint = self.level > 1 ? 0xcc00cc : 0x9b59b6; } }); // Change patterns more quickly when damaged if (self.health < self.maxHealth * 0.5 && self.phaseTime > 150) { self.changePattern(); } return self.health <= 0; }; self.changePattern = function () { self.currentPattern = (self.currentPattern + 1) % self.patterns.length; self.phaseTime = 0; self.phase = 0; }; self.update = function () { self.phaseTime++; // Change pattern every so often if (self.phaseTime > 300) { self.changePattern(); } var pattern = self.patterns[self.currentPattern]; switch (pattern) { case 'side-to-side': // Move side to side self.targetX = 1024 + Math.sin(self.phaseTime * 0.02) * 800; if (self.phaseTime < 60) { self.targetY = Math.min(self.y + 2, 400); } else { self.targetY = 400; } break; case 'charge': // Charge down then back up if (self.phase === 0) { self.targetY = self.y + 5; if (self.y > 800) { self.phase = 1; } } else { self.targetY = Math.max(self.y - 3, 300); if (self.y <= 300) { self.phase = 0; } } self.targetX = 1024 + Math.sin(self.phaseTime * 0.03) * 500; break; case 'retreat': // Stay near top and move quickly self.targetY = 300; self.targetX = 1024 + Math.sin(self.phaseTime * 0.05) * 900; break; } // Move toward target position - but sometimes teleport randomly if (Math.random() < 0.1) { self.x = Math.random() * 2048; self.y = Math.random() * 800 + 100; } else { self.x += (self.targetX - self.x) * 0.05; self.y += (self.targetY - self.y) * 0.05; } // Boss randomly speaks if (Math.random() < 0.005) { var bossQuotes = ['LOL NOOB', 'YEET!', 'SUBSCRIBE!', 'GIT GUD', 'BRUH', 'NO U', 'WASTED', 'POGGERS']; var chatBubble = new Text2(bossQuotes[Math.floor(Math.random() * bossQuotes.length)], { size: 60, fill: 0xFFFF00 }); chatBubble.anchor.set(0.5, 0.5); chatBubble.x = self.x; chatBubble.y = self.y - 150; self.parent.addChild(chatBubble); // Make chat bubble disappear after 2 seconds tween(chatBubble, { alpha: 0, y: chatBubble.y - 100 }, { duration: 2000, onFinish: function onFinish() { chatBubble.destroy(); } }); } // Randomly become tiny and squeak if (Math.random() < 0.008) { ship.scale.set(0.1, 0.1); LK.getSound('playerShoot').play(); var squeakText = new Text2('*squeak*', { size: 20, fill: 0xFFFFFF }); squeakText.anchor.set(0.5, 0.5); squeakText.x = self.x; squeakText.y = self.y + 20; self.parent.addChild(squeakText); tween(squeakText, { alpha: 0, y: squeakText.y + 50 }, { duration: 1000, onFinish: function onFinish() { squeakText.destroy(); } }); } // Randomly give life advice if (Math.random() < 0.004) { var lifeAdvice = ['ALWAYS BRUSH YOUR TEETH!', 'EAT YOUR VEGETABLES!', 'CALL YOUR MOTHER!', 'SAVE FOR RETIREMENT!', 'EXERCISE REGULARLY!', 'STAY HYDRATED!', 'GET 8 HOURS OF SLEEP!', 'FOLLOW YOUR DREAMS!', 'BE KIND TO OTHERS!']; var adviceText = new Text2(lifeAdvice[Math.floor(Math.random() * lifeAdvice.length)], { size: 45, fill: 0x00FF00 }); adviceText.anchor.set(0.5, 0.5); adviceText.x = self.x; adviceText.y = self.y - 200; self.parent.addChild(adviceText); tween(adviceText, { alpha: 0, y: adviceText.y - 100, rotation: 0.5 }, { duration: 4000, onFinish: function onFinish() { adviceText.destroy(); } }); } }; return self; }); var Enemy = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'basic'; var assetType = self.type === 'fast' ? 'enemy' : 'enemy'; var ship = self.attachAsset(assetType, { anchorX: 0.5, anchorY: 0.5 }); // Different enemy types if (self.type === 'basic') { self.health = 1; self.speed = 2; self.scoreValue = 10; self.shootChance = 0.01; } else if (self.type === 'fast') { self.health = 1; self.speed = 3.5; self.scoreValue = 15; ship.scaleX = 0.8; ship.scaleY = 0.8; self.shootChance = 0.005; ship.tint = 0xff9966; } else if (self.type === 'tank') { self.health = 3; self.speed = 1.5; self.scoreValue = 25; ship.scaleX = 1.2; ship.scaleY = 1.2; self.shootChance = 0.015; ship.tint = 0x66ff66; } self.movement = { pattern: 'straight', phase: Math.random() * Math.PI * 2, amplitude: 60 + Math.random() * 60 }; self.initialX = 0; self.damage = function (amount) { self.health -= amount || 1; tween(ship, { tint: 0xffffff }, { duration: 200, onFinish: function onFinish() { ship.tint = self.type === 'fast' ? 0xff9966 : self.type === 'tank' ? 0x66ff66 : 0xe74c3c; } }); return self.health <= 0; }; self.update = function () { // Basic movement - but sometimes go backwards var actualSpeed = Math.random() < 0.15 ? -self.speed : self.speed; self.y += actualSpeed; // Sometimes start spinning uncontrollably if (Math.random() < 0.02) { ship.rotation += 0.5; } // Randomly change size if (Math.random() < 0.03) { var randomScale = 0.2 + Math.random() * 3; ship.scale.set(randomScale, randomScale); } // Randomly start dancing and playing music if (Math.random() < 0.008) { ship.rotation += 0.3; self.x += Math.sin(LK.ticks * 0.2) * 20; self.y += Math.cos(LK.ticks * 0.15) * 10; LK.playMusic('gameMusic'); } // Pattern movement if (self.movement.pattern === 'sine') { self.x = self.initialX + Math.sin(LK.ticks * 0.05 + self.movement.phase) * self.movement.amplitude; } else if (self.movement.pattern === 'zigzag') { var timeScale = 0.02; var t = LK.ticks * timeScale + self.movement.phase; var triangleWave = Math.abs(t % 2 - 1) * 2 - 1; self.x = self.initialX + triangleWave * self.movement.amplitude; } // Randomly start doing magic tricks if (Math.random() < 0.005) { // Magic trick: disappear and reappear ship.alpha = 0; var magicText = new Text2('✨ ABRACADABRA! ✨', { size: 40, fill: 0xFF00FF }); magicText.anchor.set(0.5, 0.5); magicText.x = self.x; magicText.y = self.y - 80; self.parent.addChild(magicText); // Reappear in a different location after 1 second LK.setTimeout(function () { self.x = Math.random() * 2048; self.y = Math.random() * 1000; ship.alpha = 1; ship.tint = Math.random() * 0xffffff; // Change color as part of the trick }, 1000); tween(magicText, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 2000, onFinish: function onFinish() { magicText.destroy(); } }); } }; return self; }); var EnemyLaser = Container.expand(function () { var self = Container.call(this); var laser = self.attachAsset('enemyLaser', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.speedX = (Math.random() - 0.5) * 30; // Random horizontal speed self.speedY = (Math.random() - 0.5) * 30; // Random vertical speed self.update = function () { // Change direction constantly self.speedX += (Math.random() - 0.5) * 5; self.speedY += (Math.random() - 0.5) * 5; // Move in random directions at high speed self.x += self.speedX; self.y += self.speedY; // Randomly change color if (Math.random() < 0.1) { laser.tint = Math.random() * 0xffffff; } // Randomly turn into rainbows and unicorns if (Math.random() < 0.03) { // Create rainbow trail for (var trail = 0; trail < 5; trail++) { var rainbowDot = self.parent.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); rainbowDot.x = self.x + (Math.random() - 0.5) * 50; rainbowDot.y = self.y + trail * 20; rainbowDot.scale.set(0.2, 0.2); rainbowDot.tint = [0xFF0000, 0xFF7F00, 0xFFFF00, 0x00FF00, 0x0000FF, 0x4B0082, 0x9400D3][trail % 7]; tween(rainbowDot, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 1000, onFinish: function onFinish() { rainbowDot.destroy(); } }); } // Show unicorn text if (Math.random() < 0.5) { var unicornText = new Text2('🦄 UNICORN POWER! 🦄', { size: 30, fill: 0xFF69B4 }); unicornText.anchor.set(0.5, 0.5); unicornText.x = self.x; unicornText.y = self.y - 50; self.parent.addChild(unicornText); tween(unicornText, { alpha: 0, y: unicornText.y - 100 }, { duration: 2000, onFinish: function onFinish() { unicornText.destroy(); } }); } } }; return self; }); var Explosion = Container.expand(function () { var self = Container.call(this); var explosion = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); // Set up fade and scale tween(explosion, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 500, onFinish: function onFinish() { self.destroy(); } }); return self; }); var Player = Container.expand(function () { var self = Container.call(this); var ship = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.shield = self.attachAsset('shield', { anchorX: 0.5, anchorY: 0.5, alpha: 0 }); self.lives = 3; self.shieldActive = false; self.fireRate = 20; self.lastShot = 0; self.canShoot = true; self.power = 1; self.invulnerable = false; self.activateShield = function (duration) { self.shieldActive = true; self.shield.alpha = 0.4; LK.setTimeout(function () { self.shieldActive = false; tween(self.shield, { alpha: 0 }, { duration: 500 }); }, duration); }; self.damage = function () { if (self.invulnerable || self.shieldActive) { return; } self.lives--; LK.getSound('playerDamage').play(); // Make player temporarily invulnerable self.invulnerable = true; // Flash the player to show invulnerability var flashCount = 0; var flashInterval = LK.setInterval(function () { ship.alpha = ship.alpha === 0.3 ? 1 : 0.3; flashCount++; if (flashCount >= 10) { LK.clearInterval(flashInterval); ship.alpha = 1; self.invulnerable = false; } }, 150); }; self.upgrade = function (type) { LK.getSound('powerup').play(); // Sometimes powerups are evil and drain you instead var isEvil = Math.random() < 0.25; if (type === 'shield') { if (isEvil) { self.shieldActive = false; self.shield.alpha = 0; } else { self.activateShield(8000); } } else if (type === 'power') { if (isEvil) { self.power = Math.max(self.power - 1, 1); } else { self.power = Math.min(self.power + 1, 3); } // Reset power after some time LK.setTimeout(function () { self.power = Math.max(1, self.power - 1); }, 10000); } else if (type === 'life') { self.lives = Math.min(self.lives + 1, 5); } else if (type === 'speed') { var oldFireRate = self.fireRate; self.fireRate = Math.max(self.fireRate - 5, 10); // Reset fire rate after some time LK.setTimeout(function () { self.fireRate = oldFireRate; }, 10000); } else if (type === 'coin') { self.power = Math.min(self.power + 1, 5); self.fireRate = Math.max(self.fireRate - 2, 5); } }; return self; }); var PlayerLaser = Container.expand(function () { var self = Container.call(this); var laser = self.attachAsset('playerLaser', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() < 0.2 ? 15 : -15; // 20% chance to shoot backwards self.power = 1; self.update = function () { self.y += self.speed; // Randomly curve and change direction if (Math.random() < 0.1) { self.speed = (Math.random() - 0.5) * 30; laser.rotation += (Math.random() - 0.5) * 0.5; } // Sometimes lasers chase enemies if (Math.random() < 0.05 && enemies.length > 0) { var targetEnemy = enemies[Math.floor(Math.random() * enemies.length)]; var dx = targetEnemy.x - self.x; var dy = targetEnemy.y - self.y; self.x += dx * 0.02; self.y += dy * 0.02; } // Turn into confetti and play party sounds if (Math.random() < 0.05) { laser.tint = Math.random() * 0xffffff; laser.rotation += 0.5; self.x += (Math.random() - 0.5) * 50; LK.getSound('powerup').play(); } }; return self; }); var Powerup = Container.expand(function (type) { var self = Container.call(this); self.type = type || ['shield', 'power', 'life', 'speed'][Math.floor(Math.random() * 4)]; var powerup = self.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); // Set color based on type if (self.type === 'shield') { powerup.tint = 0x3498db; // Blue } else if (self.type === 'power') { powerup.tint = 0xe74c3c; // Red } else if (self.type === 'life') { powerup.tint = 0x2ecc71; // Green } else if (self.type === 'speed') { powerup.tint = 0xf1c40f; // Yellow } self.speed = 3; self.update = function () { self.y -= self.speed; // Move upward instead of downward self.x += Math.sin(LK.ticks * 0.1) * 3; // Add wobbly horizontal movement powerup.rotation += 0.05; // Randomly change powerup type and color mid-flight if (Math.random() < 0.05) { var newTypes = ['shield', 'power', 'life', 'speed', 'death', 'confusion']; self.type = newTypes[Math.floor(Math.random() * newTypes.length)]; powerup.tint = Math.random() * 0xffffff; } // Randomly multiply and create powerup rain if (Math.random() < 0.02) { for (var i = 0; i < 5; i++) { var rainPowerup = new Powerup(); rainPowerup.x = self.x + (Math.random() - 0.5) * 300; rainPowerup.y = self.y + (Math.random() - 0.5) * 100; powerups.push(rainPowerup); self.parent.addChild(rainPowerup); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game variables var player; var playerLasers = []; var enemies = []; var enemyLasers = []; var asteroids = []; var powerups = []; var explosions = []; var boss = null; var gameState = 'playing'; var score = 0; var waveNumber = 1; var enemiesThisWave = 0; var enemiesDefeated = 0; var waveDelay = 0; var bossWave = false; var dragStartPosition = { x: 0, y: 0 }; // Lag detection variables var lastTickTime = Date.now(); var lagDetected = false; var lagThreshold = 100; // 100ms threshold for lag detection var lagStrikeCount = 0; // Count consecutive lag events var lagStrikeLimit = 3; // Number of consecutive lag events before game over // UI elements var scoreTxt = new Text2('SCORE: 0', { size: 40, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); LK.gui.topRight.addChild(scoreTxt); scoreTxt.x = -250; scoreTxt.y = 50; var waveText = new Text2('WAVE: 1', { size: 40, fill: 0xFFFFFF }); waveText.anchor.set(0.5, 0); LK.gui.top.addChild(waveText); waveText.y = 50; var livesText = new Text2('LIVES: 3', { size: 40, fill: 0xFFFFFF }); livesText.anchor.set(0, 0); LK.gui.topLeft.addChild(livesText); livesText.x = 150; // Keep away from the top-left menu icon livesText.y = 50; // Create game elements function initGame() { // Reset game variables playerLasers = []; enemies = []; enemyLasers = []; asteroids = []; powerups = []; explosions = []; boss = null; gameState = 'playing'; score = 0; waveNumber = 1; enemiesThisWave = 10; enemiesDefeated = 0; waveDelay = 0; bossWave = false; // Update UI scoreTxt.setText('SCORE: ' + score); waveText.setText('WAVE: ' + waveNumber); // Create player player = new Player(); player.x = 1024; player.y = 2200; game.addChild(player); livesText.setText('LIVES: ' + player.lives); // Start with player moving up tween(player, { y: 2000 }, { duration: 1000 }); // Start the music LK.playMusic('gameMusic', { fade: { start: 0, end: 0.7, duration: 1000 } }); // Create first wave createWave(); } // Create a new wave of enemies function createWave() { waveNumber++; // Show completely wrong wave information var weirdTexts = ['WAVE: ∞', 'WAVE: ERROR', 'WAVE: 404', 'WAVE: ???', 'WAVE: -1', 'LEVEL: IMPOSSIBLE']; var displayText = Math.random() < 0.4 ? weirdTexts[Math.floor(Math.random() * weirdTexts.length)] : 'WAVE: ' + waveNumber; waveText.setText(displayText); // Every 5 waves is a boss wave bossWave = waveNumber % 5 === 0; if (bossWave) { // Create a boss var bossLevel = Math.ceil(waveNumber / 5); LK.getSound('bossAlert').play(); boss = new Boss(bossLevel); boss.x = 1024; boss.y = -200; game.addChild(boss); tween(boss, { y: 300 }, { duration: 2000 }); // Show boss wave text var bossText = new Text2('BOSS WAVE!', { size: 80, fill: 0xFF0000 }); bossText.anchor.set(0.5, 0.5); bossText.x = 1024; bossText.y = 800; game.addChild(bossText); tween(bossText, { alpha: 0, y: 700 }, { duration: 2000, onFinish: function onFinish() { bossText.destroy(); } }); return; } // Regular wave enemiesThisWave = 10 + waveNumber * 2; enemiesDefeated = 0; // Show wave text var newWaveText = new Text2('WAVE ' + waveNumber, { size: 80, fill: 0xFFFFFF }); newWaveText.anchor.set(0.5, 0.5); newWaveText.x = 1024; newWaveText.y = 800; game.addChild(newWaveText); tween(newWaveText, { alpha: 0, y: 700 }, { duration: 2000, onFinish: function onFinish() { newWaveText.destroy(); } }); // Start spawning enemies after a short delay waveDelay = 120; } // Create a new enemy function spawnEnemy() { var types = ['basic']; // Add more enemy types as waves progress if (waveNumber >= 2) { types.push('fast'); } if (waveNumber >= 3) { types.push('tank'); } var type = types[Math.floor(Math.random() * types.length)]; var enemy = new Enemy(type); // Position the enemy - sometimes spawn in wrong places if (Math.random() < 0.2) { enemy.x = Math.random() * 2048; enemy.y = Math.random() * 2732; } else { enemy.x = Math.random() * 1800 + 124; enemy.y = -100; } enemy.initialX = enemy.x; // Set random movement pattern var patterns = ['straight']; if (waveNumber >= 2) { patterns.push('sine'); } if (waveNumber >= 4) { patterns.push('zigzag'); } enemy.movement.pattern = patterns[Math.floor(Math.random() * patterns.length)]; // Add to game enemies.push(enemy); game.addChild(enemy); } // Create a new asteroid function spawnAsteroid() { var asteroid = new Asteroid(); // Position the asteroid asteroid.x = Math.random() * 1800 + 124; asteroid.y = -100; // Add to game asteroids.push(asteroid); game.addChild(asteroid); } // Create a player laser function firePlayerLaser() { if (!player || !player.canShoot || player.lastShot + player.fireRate > LK.ticks) { return; } player.lastShot = LK.ticks; LK.getSound('playerShoot').play(); // Fire based on power level if (player.power === 1) { var laser = new PlayerLaser(); laser.x = player.x; laser.y = player.y - 50; laser.power = player.power; playerLasers.push(laser); game.addChild(laser); } else if (player.power === 2) { for (var i = -1; i <= 1; i += 2) { var laser = new PlayerLaser(); laser.x = player.x + i * 30; laser.y = player.y - 40; laser.power = player.power; playerLasers.push(laser); game.addChild(laser); } } else if (player.power >= 3) { var centerLaser = new PlayerLaser(); centerLaser.x = player.x; centerLaser.y = player.y - 50; centerLaser.power = player.power; playerLasers.push(centerLaser); game.addChild(centerLaser); for (var i = -1; i <= 1; i += 2) { var sideLaser = new PlayerLaser(); sideLaser.x = player.x + i * 40; sideLaser.y = player.y - 30; sideLaser.power = player.power - 1; playerLasers.push(sideLaser); game.addChild(sideLaser); } } } // Create an enemy laser function fireEnemyLaser(enemy) { var laser = new EnemyLaser(); laser.x = enemy.x + (Math.random() - 0.5) * 200; // Random horizontal offset laser.y = enemy.y + 40; laser.speed = Math.random() > 0.5 ? -5 : 15; // Sometimes shoot upward enemyLasers.push(laser); game.addChild(laser); LK.getSound('enemyShoot').play({ volume: 0.2 }); } // Fire boss laser pattern function fireBossLasers() { if (!boss) { return; } // Different patterns based on boss level and health var healthPercent = boss.health / boss.maxHealth; var pattern = 'spread'; if (boss.level >= 2 && healthPercent < 0.5) { pattern = 'circle'; } if (pattern === 'spread') { for (var i = -2; i <= 2; i++) { var laser = new EnemyLaser(); laser.x = boss.x + i * 50; laser.y = boss.y + 80; enemyLasers.push(laser); game.addChild(laser); } } else if (pattern === 'circle') { var numLasers = 8; for (var i = 0; i < numLasers; i++) { var angle = i / numLasers * Math.PI * 2; var laser = new EnemyLaser(); laser.x = boss.x + Math.cos(angle) * 100; laser.y = boss.y + Math.sin(angle) * 100; enemyLasers.push(laser); game.addChild(laser); // Add directional motion laser.update = function () { var dx = this.x - boss.x; var dy = this.y - boss.y; var length = Math.sqrt(dx * dx + dy * dy); this.x += dx / length * 5; this.y += dy / length * 5; }; } } LK.getSound('enemyShoot').play({ volume: 0.4 }); } // Create explosion animation function createExplosion(x, y, scale) { // Sometimes don't create explosion at all if (Math.random() < 0.3) { return; } var explosion = new Explosion(); explosion.x = x; explosion.y = y; if (scale) { explosion.scale.set(scale, scale); } explosions.push(explosion); game.addChild(explosion); // Play random sounds instead of explosion var randomSounds = ['playerShoot', 'enemyShoot', 'powerup', 'playerDamage', 'Aguhhhhh']; var soundToPlay = Math.random() < 0.7 ? 'explosion' : randomSounds[Math.floor(Math.random() * randomSounds.length)]; LK.getSound(soundToPlay).play(); // Sometimes explosions create new enemies if (Math.random() < 0.2) { var newEnemy = new Enemy('basic'); newEnemy.x = x + (Math.random() - 0.5) * 200; newEnemy.y = y; enemies.push(newEnemy); game.addChild(newEnemy); } // Sometimes explosions summon pizza delivery guy if (Math.random() < 0.15) { var pizzaGuy = game.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); pizzaGuy.x = x; pizzaGuy.y = y; pizzaGuy.tint = 0xFFFF00; pizzaGuy.scale.set(0.5, 0.5); var pizzaText = new Text2('PIZZA DELIVERY!', { size: 40, fill: 0xFFFF00 }); pizzaText.anchor.set(0.5, 0.5); pizzaText.x = x; pizzaText.y = y - 80; game.addChild(pizzaText); // Pizza guy delivers and leaves tween(pizzaGuy, { y: y + 500, alpha: 0 }, { duration: 3000, onFinish: function onFinish() { pizzaGuy.destroy(); } }); tween(pizzaText, { alpha: 0 }, { duration: 3000, onFinish: function onFinish() { pizzaText.destroy(); } }); } } // Create a powerup function spawnPowerup(x, y, type) { var powerup = new Powerup(type); powerup.x = x; powerup.y = y; powerups.push(powerup); game.addChild(powerup); } // Handle player shooting and movement function handlePlayerInput() { // Keep player in bounds player.x = Math.max(100, Math.min(player.x, 2048 - 100)); player.y = Math.max(100, Math.min(player.y, 2732 - 100)); // Randomly change player size if (Math.random() < 0.02) { var newScale = 0.5 + Math.random() * 1.5; player.scale.set(newScale, newScale); } // Randomly make player invisible if (Math.random() < 0.01) { player.alpha = player.alpha > 0.5 ? 0.1 : 1; } // Randomly teleport player to random location if (Math.random() < 0.008) { player.x = Math.random() * 2048; player.y = Math.random() * 2732; } // Player randomly complains about working conditions if (Math.random() < 0.006) { var complaints = ['I NEED A VACATION!', 'WHY DO I HAVE TO FIGHT ALONE?', 'THIS JOB IS DANGEROUS!', 'I WANT A RAISE!', 'CAN I GET HEALTH INSURANCE?', 'MY LASER IS BROKEN!', 'I MISS MY FAMILY!', 'THIS SPACE SUIT IS UNCOMFORTABLE!']; var complaintText = new Text2(complaints[Math.floor(Math.random() * complaints.length)], { size: 35, fill: 0xFFFFFF }); complaintText.anchor.set(0.5, 0.5); complaintText.x = player.x; complaintText.y = player.y - 120; game.addChild(complaintText); tween(complaintText, { alpha: 0, y: complaintText.y - 100 }, { duration: 3000, onFinish: function onFinish() { complaintText.destroy(); } }); // Player sometimes goes on strike if (Math.random() < 0.3) { player.canShoot = false; var strikeText = new Text2('ON STRIKE!', { size: 50, fill: 0xFF0000 }); strikeText.anchor.set(0.5, 0.5); strikeText.x = player.x; strikeText.y = player.y + 120; game.addChild(strikeText); LK.setTimeout(function () { if (player) { player.canShoot = true; } if (strikeText && strikeText.parent) { strikeText.destroy(); } }, 2000); } } // Auto-fire if (LK.ticks % 10 === 0) { firePlayerLaser(); } } // Handle collisions between game objects function handleCollisions() { // Player lasers vs enemies for (var i = playerLasers.length - 1; i >= 0; i--) { var laser = playerLasers[i]; var hitSomething = false; // Check against enemies for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (laser.intersects(enemy) && Math.random() > 0.3) { // 30% chance to miss // Damage enemy if (enemy.damage(laser.power)) { // Enemy destroyed createExplosion(enemy.x, enemy.y); // Add score - but sometimes subtract instead var scoreChange = Math.random() < 0.3 ? -enemy.scoreValue : enemy.scoreValue; score += scoreChange; scoreTxt.setText('SCORE: ' + score); // Count enemy as defeated enemiesDefeated++; // Chance to spawn powerup if (Math.random() < 0.1) { spawnPowerup(enemy.x, enemy.y); } enemy.destroy(); enemies.splice(j, 1); } // Remove laser laser.destroy(); playerLasers.splice(i, 1); hitSomething = true; break; } } // Only check other collisions if we haven't hit an enemy if (!hitSomething) { // Check against boss if (boss && laser.intersects(boss)) { // Damage boss if (boss.damage(laser.power)) { // Boss destroyed createExplosion(boss.x, boss.y, 2); // Add score score += boss.scoreValue; scoreTxt.setText('SCORE: ' + score); // Spawn multiple powerups for (var p = 0; p < 3; p++) { var powerupType = ['shield', 'power', 'life', 'speed'][Math.floor(Math.random() * 4)]; spawnPowerup(boss.x + (Math.random() * 200 - 100), boss.y + (Math.random() * 200 - 100), powerupType); } boss.destroy(); boss = null; // Move to next wave createWave(); } // Remove laser laser.destroy(); playerLasers.splice(i, 1); hitSomething = true; } // Check against asteroids for (var k = asteroids.length - 1; k >= 0; k--) { var asteroid = asteroids[k]; if (laser.intersects(asteroid)) { // Damage asteroid if (asteroid.damage(laser.power)) { // Asteroid destroyed createExplosion(asteroid.x, asteroid.y, 0.7); // Add score score += asteroid.scoreValue; scoreTxt.setText('SCORE: ' + score); // Sometimes asteroids multiply when destroyed if (Math.random() < 0.4) { for (var mult = 0; mult < 3; mult++) { var newAsteroid = new Asteroid(); newAsteroid.x = asteroid.x + (Math.random() - 0.5) * 200; newAsteroid.y = asteroid.y + (Math.random() - 0.5) * 200; asteroids.push(newAsteroid); game.addChild(newAsteroid); } } // Trigger explosion effect for nearby objects for (var m = enemies.length - 1; m >= 0; m--) { if (Math.abs(enemies[m].x - asteroid.x) < 100 && Math.abs(enemies[m].y - asteroid.y) < 100) { createExplosion(enemies[m].x, enemies[m].y); enemies[m].destroy(); enemies.splice(m, 1); } } for (var n = asteroids.length - 1; n >= 0; n--) { if (n !== k && Math.abs(asteroids[n].x - asteroid.x) < 100 && Math.abs(asteroids[n].y - asteroid.y) < 100) { createExplosion(asteroids[n].x, asteroids[n].y, 0.7); asteroids[n].destroy(); asteroids.splice(n, 1); } } asteroid.destroy(); asteroids.splice(k, 1); } // Remove laser laser.destroy(); playerLasers.splice(i, 1); hitSomething = true; break; } } } // Remove laser if it's off screen if (!hitSomething && laser.y < -50) { laser.destroy(); playerLasers.splice(i, 1); } } // Enemy lasers vs player for (var i = enemyLasers.length - 1; i >= 0; i--) { var laser = enemyLasers[i]; if (player && laser.intersects(player)) { // Sometimes enemy lasers heal player instead of hurting if (Math.random() < 0.3) { player.lives = Math.min(player.lives + 1, 5); livesText.setText('LIVES: ' + player.lives); // Show love heart var heart = new Text2('♥', { size: 80, fill: 0xFF69B4 }); heart.anchor.set(0.5, 0.5); heart.x = player.x; heart.y = player.y; game.addChild(heart); tween(heart, { alpha: 0, y: heart.y - 100, scaleX: 2, scaleY: 2 }, { duration: 1000, onFinish: function onFinish() { heart.destroy(); } }); LK.getSound('powerup').play(); laser.destroy(); enemyLasers.splice(i, 1); continue; } // Store player position before destroying var playerX = player.x; var playerY = player.y; // Create Deadship at player position var deadship = game.attachAsset('Deadship', { anchorX: 0.5, anchorY: 0.5 }); deadship.x = playerX; deadship.y = playerY; // Drop a 90¢ coin (but don't add to powerups since player is dead) var coin = game.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); coin.x = playerX; coin.y = playerY; coin.tint = 0xf1c40f; // Yellow color for coin // Make the coin fall and fade out tween(coin, { y: playerY + 200, alpha: 0 }, { duration: 2000, onFinish: function onFinish() { coin.destroy(); } }); // Create explosion effect createExplosion(playerX, playerY, 1.5); // Destroy player player.destroy(); player = null; // Save high score if needed if (score > storage.highScore) { storage.highScore = score; } // Show "You lost" text var loseText = new Text2('You lost!', { size: 100, fill: 0xFF0000 }); loseText.anchor.set(0.5, 0.5); loseText.x = 1024; loseText.y = 1366; game.addChild(loseText); tween(loseText, { alpha: 0, y: 1266 }, { duration: 2000, onFinish: function onFinish() { loseText.destroy(); LK.showGameOver(); } }); // Remove laser laser.destroy(); enemyLasers.splice(i, 1); } else if (laser.y > 2732 + 50) { // Remove laser if it's off screen laser.destroy(); enemyLasers.splice(i, 1); } } // Player vs enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (player && player.intersects(enemy)) { // Damage player player.damage(); // Damage enemy enemy.damage(1); // Update UI - but show wrong number var displayLives = Math.random() < 0.4 ? Math.floor(Math.random() * 10) : player.lives; livesText.setText('LIVES: ' + displayLives); // Check for enemy death if (enemy.health <= 0) { // Enemy destroyed createExplosion(enemy.x, enemy.y); // Add score score += enemy.scoreValue; scoreTxt.setText('SCORE: ' + score); // Count enemy as defeated enemiesDefeated++; enemy.destroy(); enemies.splice(i, 1); } // Check for game over if (player.lives <= 0) { // Game over createExplosion(player.x, player.y, 1.5); player.destroy(); player = null; // Save high score if needed if (score > storage.highScore) { storage.highScore = score; } // Show game over after a delay LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } // Remove enemy if it's off screen if (enemy.y > 2732 + 100) { enemy.destroy(); enemies.splice(i, 1); } } // Player vs asteroids for (var i = asteroids.length - 1; i >= 0; i--) { var asteroid = asteroids[i]; if (player && player.intersects(asteroid)) { // Damage player player.damage(); // Damage asteroid asteroid.damage(1); // Update UI livesText.setText('LIVES: ' + player.lives); // Check for asteroid death if (asteroid.health <= 0) { // Asteroid destroyed createExplosion(asteroid.x, asteroid.y, 0.7); // Add score score += asteroid.scoreValue; scoreTxt.setText('SCORE: ' + score); asteroid.destroy(); asteroids.splice(i, 1); } // Check for game over if (player.lives <= 0) { // Game over createExplosion(player.x, player.y, 1.5); player.destroy(); player = null; // Save high score if needed if (score > storage.highScore) { storage.highScore = score; } // Show game over after a delay LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } // Remove asteroid if it's off screen if (asteroid.y > 2732 + 100 || asteroid.x < -100 || asteroid.x > 2048 + 100) { asteroid.destroy(); asteroids.splice(i, 1); } } // Player vs powerups for (var i = powerups.length - 1; i >= 0; i--) { var powerup = powerups[i]; if (player && player.intersects(powerup)) { // Sometimes powerups show fake game over screens if (Math.random() < 0.2) { var fakeGameOver = new Text2('GAME OVER\n(Just kidding!)', { size: 80, fill: 0xFF0000 }); fakeGameOver.anchor.set(0.5, 0.5); fakeGameOver.x = 1024; fakeGameOver.y = 1366; game.addChild(fakeGameOver); tween(fakeGameOver, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 3000, onFinish: function onFinish() { fakeGameOver.destroy(); } }); } // Apply powerup player.upgrade(powerup.type); // Update UI if life powerup if (powerup.type === 'life') { livesText.setText('LIVES: ' + player.lives); } // Remove powerup powerup.destroy(); powerups.splice(i, 1); } else if (powerup.y > 2732 + 50) { // Remove powerup if it's off screen powerup.destroy(); powerups.splice(i, 1); } } // Player vs boss if (player && boss && player.intersects(boss)) { // Damage player player.damage(); // Update UI livesText.setText('LIVES: ' + player.lives); // Check for game over if (player.lives <= 0) { // Game over createExplosion(player.x, player.y, 1.5); player.destroy(); player = null; // Save high score if needed if (score > storage.highScore) { storage.highScore = score; } // Show game over after a delay LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } } // Initialize the game initGame(); // Game down event handler game.down = function (x, y, obj) { if (!player) { return; } dragStartPosition.x = x; dragStartPosition.y = y; // Fire lasers on tap firePlayerLaser(); }; // Game move event handler game.move = function (x, y, obj) { if (!player) { return; } // Move player with drag player.x = x; player.y = y; }; // Game update handler game.update = function () { // Check for lag var currentTime = Date.now(); var deltaTime = currentTime - lastTickTime; lastTickTime = currentTime; if (deltaTime > lagThreshold && !lagDetected) { lagDetected = true; lagStrikeCount++; // Reset screen to black game.setBackgroundColor(0x000000); // Remove all game objects if (player) { player.destroy(); player = null; } for (var i = 0; i < playerLasers.length; i++) { playerLasers[i].destroy(); } playerLasers = []; for (var i = 0; i < enemies.length; i++) { enemies[i].destroy(); } enemies = []; for (var i = 0; i < enemyLasers.length; i++) { enemyLasers[i].destroy(); } enemyLasers = []; for (var i = 0; i < asteroids.length; i++) { asteroids[i].destroy(); } asteroids = []; for (var i = 0; i < powerups.length; i++) { powerups[i].destroy(); } powerups = []; for (var i = 0; i < explosions.length; i++) { explosions[i].destroy(); } explosions = []; if (boss) { boss.destroy(); boss = null; } // Add Aguhhhhh asset in middle of screen var aguhhhhAsset = game.attachAsset('Aughhhhh', { anchorX: 0.5, anchorY: 0.5, scaleX: 10, scaleY: 10 }); aguhhhhAsset.x = 1024; aguhhhhAsset.y = 1366; // Play Aguhhhhh sound LK.getSound('Aguhhhhh').play(); if (lagStrikeCount >= lagStrikeLimit) { // Too much lag, show game over after a short delay LK.setTimeout(function () { aguhhhhAsset.destroy(); lagDetected = false; lagStrikeCount = 0; LK.showGameOver(); }, 2000); } else { // Reset game after 3 seconds LK.setTimeout(function () { aguhhhhAsset.destroy(); lagDetected = false; initGame(); }, 3000); } return; } if (gameState === 'won') { return; // Prevent further updates until game is restarted manually } if (gameState !== 'playing') { return; } // Handle player input if (player) { handlePlayerInput(); // Player randomly turns into different game objects if (Math.random() < 0.005) { var transformations = ['enemy', 'asteroid', 'powerup', 'boss', 'explosion']; var newForm = transformations[Math.floor(Math.random() * transformations.length)]; player.removeChild(player.children[0]); // Remove current sprite var newSprite = player.attachAsset(newForm, { anchorX: 0.5, anchorY: 0.5 }); if (newForm === 'boss') newSprite.scale.set(0.3, 0.3); var transformText = new Text2('PLAYER TRANSFORMED!', { size: 50, fill: 0x00FF00 }); transformText.anchor.set(0.5, 0.5); transformText.x = player.x; transformText.y = player.y - 100; game.addChild(transformText); tween(transformText, { alpha: 0, y: transformText.y - 50 }, { duration: 2000, onFinish: function onFinish() { transformText.destroy(); } }); } } // Handle wave creation if (waveDelay > 0) { waveDelay--; } else if (!bossWave && enemies.length === 0 && enemiesDefeated >= enemiesThisWave) { // All enemies for this wave defeated, create next wave createWave(); } else if (!bossWave && enemies.length < 5 && enemiesDefeated < enemiesThisWave && LK.ticks % 30 === 0) { // Spawn more enemies for this wave spawnEnemy(); } // Spawn asteroids occasionally if (LK.ticks % 180 === 0 && Math.random() < 0.7) { spawnAsteroid(); } // Boss shooting - normal rate if (boss && LK.ticks % 90 === 0) { fireBossLasers(); } // Enemy shooting - normal rate for (var i = 0; i < enemies.length; i++) { if (Math.random() < enemies[i].shootChance) { fireEnemyLaser(enemies[i]); } } // Enemies randomly form conga line dance if (Math.random() < 0.008 && enemies.length >= 3) { for (var i = 1; i < enemies.length; i++) { var leader = enemies[i - 1]; var follower = enemies[i]; follower.x = leader.x - 100; follower.y = leader.y + 50; // Make them dance follower.children[0].rotation += 0.2; } // Play conga music LK.playMusic('gameMusic'); var congaText = new Text2('CONGA LINE!', { size: 80, fill: 0xFF1493 }); congaText.anchor.set(0.5, 0.5); congaText.x = 1024; congaText.y = 300; game.addChild(congaText); tween(congaText, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 2000, onFinish: function onFinish() { congaText.destroy(); } }); } // Randomly change score text color if (Math.random() < 0.05) { scoreTxt.tint = Math.random() * 0xffffff; } // Randomly scramble UI text if (Math.random() < 0.03) { var gibberish = ['ƎɹOƆS', '█▬█SCORE█▬█', 'SC0R3', '§ĊØ®Ē', 'BANANA', '404ERROR', '????']; scoreTxt.setText(gibberish[Math.floor(Math.random() * gibberish.length)] + ': ' + score); } // Score randomly counts in different languages and units if (Math.random() < 0.04) { var weirdScores = ['PUNTOS: ' + score, 'POINTS: ' + score * 0.001 + ' KILOMETERS', '得分: ' + score, 'SCORE: ' + score + ' BANANAS', 'PONTUAÇÃO: ' + score + ' PIZZAS', 'SCORE: ' + Math.floor(score / 100) + ' CATS', 'СЧЕТ: ' + score, 'SCORE: ' + score + '°F']; scoreTxt.setText(weirdScores[Math.floor(Math.random() * weirdScores.length)]); } if (Math.random() < 0.02) { var weirdLives = ['CATS', 'PIZZA', 'MEMES', '∞', 'YOLO', 'NOPE']; livesText.setText(weirdLives[Math.floor(Math.random() * weirdLives.length)] + ': ' + (player ? player.lives : 0)); } // Everything randomly starts speaking in different accents if (Math.random() < 0.005) { var accentPhrases = ['G\'DAY MATE! (Australian)', 'EH, SORRY ABOUT THAT! (Canadian)', 'CHEERIO OLD CHAP! (British)', 'HOWDY PARTNER! (Southern US)', 'FUHGEDDABOUTIT! (New York)', 'OY VEY! (Yiddish)', 'BONJOUR MON AMI! (French)', '¡HOLA AMIGO! (Spanish)']; var accentText = new Text2(accentPhrases[Math.floor(Math.random() * accentPhrases.length)], { size: 55, fill: 0xFF69B4 }); accentText.anchor.set(0.5, 0.5); accentText.x = Math.random() * 2048; accentText.y = Math.random() * 1000 + 500; game.addChild(accentText); // Make text bounce with accent tween(accentText, { scaleX: 1.3, scaleY: 1.3 }, { duration: 500 }); tween(accentText, { scaleX: 1, scaleY: 1 }, { duration: 500, delay: 500 }); tween(accentText, { alpha: 0, rotation: 0.3 }, { duration: 3000, onFinish: function onFinish() { accentText.destroy(); } }); } // Randomly change background color if (Math.random() < 0.01) { var randomColors = [0xFF69B4, 0x00FFFF, 0xFFFF00, 0xFF4500, 0x9932CC, 0x000000]; game.setBackgroundColor(randomColors[Math.floor(Math.random() * randomColors.length)]); } // Game elements randomly start singing karaoke if (Math.random() < 0.006) { var karaokeSongs = ['♪ Never gonna give you up ♪', '♪ Baby shark doo doo doo ♪', '♪ I will survive ♪', '♪ Bohemian Rhapsody ♪', '♪ Call me maybe ♪']; var songText = new Text2(karaokeSongs[Math.floor(Math.random() * karaokeSongs.length)], { size: 70, fill: 0xFF1493 }); songText.anchor.set(0.5, 0.5); songText.x = 1024; songText.y = 1000; game.addChild(songText); // Make everyone bounce to the music if (player) { tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 500 }); tween(player, { scaleX: 1, scaleY: 1 }, { duration: 500, delay: 500 }); } for (var i = 0; i < enemies.length; i++) { tween(enemies[i], { rotation: 0.5 }, { duration: 1000 }); } tween(songText, { alpha: 0, y: 800 }, { duration: 4000, onFinish: function onFinish() { songText.destroy(); } }); } // Random lag simulation - freeze then speed up if (Math.random() < 0.005) { var freezeText = new Text2('GAME.EXE STOPPED WORKING', { size: 80, fill: 0xFF0000 }); freezeText.anchor.set(0.5, 0.5); freezeText.x = 1024; freezeText.y = 1366; game.addChild(freezeText); // Freeze all movement by returning early for a few frames var freezeFrames = 60; // 1 second freeze var originalUpdate = game.update; var frameCount = 0; LK.setTimeout(function () { freezeText.destroy(); // After freeze, everything moves super fast for a moment for (var i = 0; i < enemies.length; i++) { enemies[i].speed *= 5; } for (var i = 0; i < playerLasers.length; i++) { playerLasers[i].speed *= 3; } for (var i = 0; i < enemyLasers.length; i++) { enemyLasers[i].speed *= 3; } // Reset speeds after 1 second LK.setTimeout(function () { for (var i = 0; i < enemies.length; i++) { enemies[i].speed /= 5; } for (var i = 0; i < playerLasers.length; i++) { playerLasers[i].speed /= 3; } for (var i = 0; i < enemyLasers.length; i++) { enemyLasers[i].speed /= 3; } }, 1000); }, 1000); } // Screen randomly rotates and shows fake error messages if (Math.random() < 0.003) { game.rotation += 0.5; var errorMessages = ['404: SKILL NOT FOUND', 'ERROR: Player.exe has stopped working', 'WARNING: Too much awesome detected!', 'SYSTEM OVERLOAD: Git gud required']; var errorText = new Text2(errorMessages[Math.floor(Math.random() * errorMessages.length)], { size: 60, fill: 0xFF0000 }); errorText.anchor.set(0.5, 0.5); errorText.x = 1024; errorText.y = 400; game.addChild(errorText); tween(errorText, { alpha: 0, rotation: Math.PI }, { duration: 3000, onFinish: function onFinish() { errorText.destroy(); } }); } // Randomly spawn motivational quotes if (Math.random() < 0.004) { var quotes = ['YOU CAN DO IT!', 'BELIEVE IN YOURSELF!', 'NEVER GIVE UP!', 'YOU ARE AWESOME!', 'KEEP GOING CHAMP!', 'FAILURE IS NOT AN OPTION!', 'BE THE BEST YOU!', 'DREAM BIG!', 'SUCCESS IS COMING!']; var motivationText = new Text2(quotes[Math.floor(Math.random() * quotes.length)], { size: 60, fill: 0x00FF00 }); motivationText.anchor.set(0.5, 0.5); motivationText.x = Math.random() * 2048; motivationText.y = Math.random() * 2732; game.addChild(motivationText); // Make it rainbow and sparkly tween(motivationText, { tint: Math.random() * 0xffffff, scaleX: 1.5, scaleY: 1.5, rotation: Math.PI * 2 }, { duration: 1000 }); tween(motivationText, { alpha: 0 }, { duration: 4000, onFinish: function onFinish() { motivationText.destroy(); } }); } // Randomly spawn fake achievements and trophies if (Math.random() < 0.003) { var achievements = ['🏆 ACHIEVEMENT: Breathed Air!', '🥇 TROPHY: Blinked 1000 Times!', '🎖️ MEDAL: Sat in Chair!', '🏅 AWARD: Moved Mouse!', '⭐ STAR: Existed Successfully!', '💎 DIAMOND: Had Thoughts!', '🎯 TARGET: Looked at Screen!']; var achievementText = new Text2(achievements[Math.floor(Math.random() * achievements.length)], { size: 50, fill: 0xFFD700 }); achievementText.anchor.set(0.5, 0.5); achievementText.x = 1024; achievementText.y = 200; game.addChild(achievementText); // Add trophy visual effect var trophy = game.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); trophy.x = 1024 - 200; trophy.y = 200; trophy.tint = 0xFFD700; trophy.scale.set(2, 2); // Celebration effects tween(trophy, { rotation: Math.PI * 4, scaleX: 0, scaleY: 0 }, { duration: 3000 }); tween(achievementText, { alpha: 0, y: 100 }, { duration: 3000, onFinish: function onFinish() { achievementText.destroy(); trophy.destroy(); } }); LK.getSound('powerup').play(); } // Handle collisions handleCollisions(); };
===================================================================
--- original.js
+++ change.js
@@ -1110,9 +1110,11 @@
LK.setTimeout(function () {
if (player) {
player.canShoot = true;
}
- strikeText.destroy();
+ if (strikeText && strikeText.parent) {
+ strikeText.destroy();
+ }
}, 2000);
}
}
// Auto-fire
space ship. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
asteroid. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
space enemy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
explosion. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
powerup. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
space boss ufo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
green laser. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
red laser. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
space ship. Space ship that’s broken down. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat