User prompt
erase evade enemy
User prompt
erase bullet storm enemy bullet
User prompt
bullet storm enemy bullet
User prompt
bullet interval 0,5 seconds
User prompt
twin bullet
User prompt
increase more bullet speed
User prompt
increase 2 times bullet speed
User prompt
increase bullet speed
User prompt
bullet interval 0,5 second
User prompt
decrease enemy bullet quantity
User prompt
decrease quantity of enemy
User prompt
increase bullet speed
User prompt
automatic bullet release
User prompt
decrease enemy speed
User prompt
game over when enemy pass of bottom
User prompt
remove bullet storm
User prompt
make bullet storm
User prompt
make bullet more slow
User prompt
make interval bullet release are 1 second per bullet
User prompt
make 1/2 second bullet interval realease
User prompt
decrease bullet speed
User prompt
find solutin or make enemy fast movement
User prompt
repair game
User prompt
fix bug
User prompt
display score bar when destroy enemy bullet
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0 }); /**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 140; // Double the speed again for faster gameplay self.damage = 1; self.update = function () { // Auto-move player left and right self.y -= self.speed; // Auto-destroy bullets that go off screen if (self.y < -50) { self.destroy(); } }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.health = 1; // Ensure enemy dies in one hit self.speed = 2 + Math.random() * 0.5; // Decrease enemy movement speed for slower gameplay self.value = 100; // score value self.canShoot = Math.random() < 0.3; // 30% of enemies can shoot self.lastShot = 0; self.fireRate = 2000 + Math.random() * 2000; // Random fire rate between 2-4 seconds // Create health bar self.healthBarBg = self.attachAsset('healthBarBg', { anchorX: 0.5, anchorY: 0.5, y: -70 }); self.healthBar = self.attachAsset('healthBar', { anchorX: 0.5, anchorY: 0.5, y: -70 }); self.updateHealthBar = function () { var healthPercentage = self.health / 2; // 2 is max health self.healthBar.scaleX = healthPercentage; }; self.damage = function (amount) { self.health -= amount; self.updateHealthBar(); // Flash enemy when hit LK.effects.flashObject(self, 0xffffff, 200); if (self.health <= 0) { // Create explosion var explosion = new Explosion(); explosion.x = self.x; explosion.y = self.y; game.addChild(explosion); // Add score LK.setScore(LK.getScore() + self.value); // Remove from array and destroy self.destroy(); } }; self.shoot = function () { // Create a single bullet var enemyBullet = new EnemyBullet(); enemyBullet.x = self.x; enemyBullet.y = self.y + 50; // Start below the enemy enemyBullet.speed = 4; // Set speed for the bullet game.addChild(enemyBullet); enemyBullets.push(enemyBullet); LK.getSound('enemyShoot').play(); }; self.update = function () { self.y += self.speed; // Remove evade behavior from enemies // Shooting logic if (self.canShoot) { var now = Date.now(); if (now - self.lastShot > self.fireRate) { self.lastShot = now; self.shoot(); } } // Destroy if off screen if (self.y > 2732 + 100) { self.destroy(); gameActive = false; updateHighScore(); LK.showGameOver(); } }; return self; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 4; // Lower enemy bullet speed for less challenging gameplay self.damage = 5; // Increase enemy bullet damage self.update = function () { self.y += self.speed; // Auto-destroy bullets that go off screen if (self.y > 2732 + 50) { self.destroy(); } }; return self; }); var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, scaleY: 0.5 }); // Play explosion sound LK.getSound('explosion').play(); // Animate explosion tween(explosionGraphics, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 3; self.health = self.maxHealth; self.fireRate = 500; // Fire rate set to 0.5 seconds per shot self.lastShot = 0; self.speed = 20; self.invulnerable = false; // Create health bar self.healthBarBg = self.attachAsset('healthBarBg', { anchorX: 0.5, anchorY: 0.5, y: -80 }); self.healthBar = self.attachAsset('healthBar', { anchorX: 0.5, anchorY: 0.5, y: -80 }); self.updateHealthBar = function () { var healthPercentage = self.health / self.maxHealth; self.healthBar.scaleX = healthPercentage; }; self.damage = function (amount) { if (self.invulnerable) { return; } self.health -= amount; self.updateHealthBar(); LK.getSound('playerHit').play(); // Flash player when hit self.invulnerable = true; LK.effects.flashObject(self, 0xff0000, 1000); LK.setTimeout(function () { self.invulnerable = false; }, 1000); if (self.health <= 0) { // Create explosion var explosion = new Explosion(); explosion.x = self.x; explosion.y = self.y; game.addChild(explosion); // Game over LK.setTimeout(function () { LK.showGameOver(); }, 1000); self.visible = false; } }; self.shoot = function () { var now = Date.now(); if (now - self.lastShot < self.fireRate) { return; } self.lastShot = now; // Create twin bullets var bulletLeft = new Bullet(); var bulletRight = new Bullet(); // Position bullets slightly apart bulletLeft.x = self.x - 20; bulletRight.x = self.x + 20; bulletLeft.y = self.y - 50; bulletRight.y = self.y - 50; // Add bullets to the game game.addChild(bulletLeft); game.addChild(bulletRight); // Add to game's bullets array bullets.push(bulletLeft); bullets.push(bulletRight); LK.getSound('playerShoot').play(); }; self.down = function (x, y, obj) { self.shoot(); // Trigger shooting when player is touched }; self.update = function () { // Manual player movement control if (gameActive) { // Movement logic will be handled in game.move // Automatically fire bullets every 60 ticks (1 second at 60 FPS) if (LK.ticks % 60 === 0) { self.shoot(); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var background = LK.getAsset('nightSky', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(background); // Game variables var player; var bullets = []; var enemyBullets = []; var enemies = []; var powerUps = []; var waveNumber = 1; var enemiesInWave = 5 + waveNumber * 2; var lastEnemySpawn = 0; var enemySpawnRate = 2000; // Increase to 2 seconds between spawns for stability var waveDelay = 5000; // 5 seconds between waves var gameActive = true; var dragActive = false; // Setup GUI var waveTxt = new Text2('WAVE 1', { size: 80, fill: 0xFFFFFF }); waveTxt.anchor.set(0.5, 0); LK.gui.top.addChild(waveTxt); waveTxt.y = 50; // Initialize player player = new Player(); player.x = 2048 / 2; player.y = 2732 - 300; player.updateHealthBar(); game.addChild(player); // Start background music LK.playMusic('bgMusic', { fade: { start: 0, end: 0.6, duration: 1000 } }); // Touch/mouse handling var lastTapTime = 0; game.down = function (x, y, obj) { if (!gameActive) { return; } var currentTime = Date.now(); if (currentTime - lastTapTime < 300) { // Double-tap detected within 300ms player.speed = 20; // Resume player movement } lastTapTime = currentTime; if (gameActive) { player.shoot(); // Shoot when tapping } }; game.move = function (x, y, obj) { if (!gameActive || !player.visible) { return; } // Constrain player to game area if (x > 100 && x < 2048 - 100) { player.x = x; } if (y > 100 && y < 2732 - 100) { player.y = y; } }; game.up = function (x, y, obj) { dragActive = false; }; // Spawn enemies for current wave function spawnWave() { if (waveNumber > 100) { gameActive = false; updateHighScore(); LK.showYouWin(); return; } enemiesInWave = 3 + waveNumber; // Further reduce the number of enemies per wave for less frequent enemy appearances waveTxt.setText('WAVE ' + waveNumber); // Show wave notification waveTxt.alpha = 1; tween(waveTxt, { alpha: 0 }, { duration: 2000, easing: tween.easeOut }); // Slightly increase enemy spawn rate with each wave enemySpawnRate = Math.max(1000, 1500 - waveNumber * 50); } // Spawn a single enemy function spawnEnemy() { var enemy = new Enemy(); enemy.x = Math.random() * (2048 - 200) + 100; // Random position between 100 and (2048-100) enemy.y = -100; // Start above the screen enemy.updateHealthBar(); // Increase enemy health every few waves if (waveNumber > 3) { enemy.health += Math.floor(waveNumber / 3); enemy.updateHealthBar(); } // Increase enemy speed slightly with each wave enemy.speed += waveNumber * 0.1; game.addChild(enemy); enemies.push(enemy); enemiesInWave--; // Decrease the count of enemies to spawn in the current wave // Trigger automatic bullet release when an enemy appears player.shoot(); } // Save the high score if needed function updateHighScore() { var currentScore = LK.getScore(); if (currentScore > storage.highScore) { storage.highScore = currentScore; } } // Main game update loop game.update = function () { if (!gameActive) { return; } // Enemy spawning logic var now = Date.now(); if (enemies.length < enemiesInWave && now - lastEnemySpawn > enemySpawnRate) { lastEnemySpawn = now; spawnEnemy(); } // Wave transition logic if (enemies.length === 0 && enemiesInWave <= 0) { waveNumber++; if (waveNumber <= 100) { // Start next wave after delay LK.setTimeout(function () { spawnWave(); }, waveDelay); enemiesInWave = 5 + waveNumber * 2; // Reset for next wave } else { gameActive = false; updateHighScore(); LK.showYouWin(); } } // Bullet collision detection for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; // Check collision with each enemy for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.intersects(enemy)) { // Damage enemy enemy.damage(bullet.damage); // Remove bullet bullet.destroy(); bullets.splice(i, 1); // If enemy is destroyed, remove from array if (enemy.health <= 0) { enemies.splice(j, 1); enemiesInWave--; } break; // This bullet hit something, stop checking } } } // Enemy bullet collision with player if (player.visible) { for (var i = enemyBullets.length - 1; i >= 0; i--) { var bullet = enemyBullets[i]; if (bullet.intersects(player)) { // Damage player player.damage(bullet.damage); // Remove bullet bullet.destroy(); enemyBullets.splice(i, 1); // Check if game over if (player.health <= 0) { gameActive = false; updateHighScore(); } } // Check collision with player bullets for (var j = bullets.length - 1; j >= 0; j--) { var playerBullet = bullets[j]; if (bullet.intersects(playerBullet)) { // Create explosion at the collision point var explosion = new Explosion(); explosion.x = bullet.x; explosion.y = bullet.y; game.addChild(explosion); // Destroy both bullets bullet.destroy(); enemyBullets.splice(i, 1); playerBullet.destroy(); bullets.splice(j, 1); // Display score bar var scoreBar = new Text2('Score: ' + LK.getScore(), { size: 50, fill: 0xFFFFFF }); scoreBar.anchor.set(0.5, 0); scoreBar.x = 2048 / 2; scoreBar.y = 100; game.addChild(scoreBar); LK.setTimeout(function () { scoreBar.destroy(); }, 2000); // Display for 2 seconds break; // Stop checking this bullet } } } // Enemy collision with player for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.intersects(player)) { // Damage player player.damage(1); // Damage enemy enemy.damage(1); // If enemy is destroyed, remove from array if (enemy.health <= 0) { enemies.splice(i, 1); enemiesInWave--; } // Check if game over if (player.health <= 0) { gameActive = false; updateHighScore(); } } } } // Clean up arrays (remove destroyed objects) bullets = bullets.filter(function (bullet) { return bullet.parent !== null; }); enemyBullets = enemyBullets.filter(function (bullet) { return bullet.parent !== null; }); enemies = enemies.filter(function (enemy) { return enemy.parent !== null; }); powerUps = powerUps.filter(function (powerUp) { return powerUp.parent !== null; }); }; // Start the first wave spawnWave();
===================================================================
--- original.js
+++ change.js
@@ -82,20 +82,9 @@
LK.getSound('enemyShoot').play();
};
self.update = function () {
self.y += self.speed;
- // Move slightly left or right
- if (LK.ticks % 30 === 0) {
- // Increase frequency of movement
- self.x += (Math.random() - 0.5) * 150; // Increase movement range
- // Loop movement within bounds
- if (self.x < 100) {
- self.x = 2048 - 100;
- }
- if (self.x > 2048 - 100) {
- self.x = 100;
- }
- }
+ // Remove evade behavior from enemies
// Shooting logic
if (self.canShoot) {
var now = Date.now();
if (now - self.lastShot > self.fireRate) {
8 bit image city of newyork with black sky night. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
8 bit image black rocket with fire tail. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
8 bit front image blue red scifi police drone. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fire explode with piece of black steel. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fire ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows