User prompt
Make the 5 boss little harder
User prompt
Make the 5 boss little less hard
User prompt
Make the 4 and 5 bosses less hard
User prompt
Make the 3 boss less hard
User prompt
Start the game music
User prompt
Make a sound bullet for the five bosses
User prompt
Make a sound bullet for every enemy
User prompt
No, superman go and take it, but it like a green thing, 2 cure every round
User prompt
Make it visible.
User prompt
Ok, Make it appear only in the case when Superman merges.
User prompt
No, superman go and take it, but it like a green thing, 2 cure every round
User prompt
Add the cure after the superman gets hit
User prompt
Make there be a cure after Superman merges.
User prompt
Every enemy has a different bullet
User prompt
Perfect, Now, make the game increase in difficulty as the rounds progress And make the enemy move more actively. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the enemies stronger, and have them shoot directly at Superman.
User prompt
More details sky
User prompt
Add a sky night
Code edit (1 edits merged)
Please save this source code
User prompt
Superman: Sky Defender
Initial prompt
The game is in horizontal (landscape)...The game is about Superman. He flies through the city skies, shooting heat vision from his eyes and battling enemies in front of him. The player must avoid enemy attacks and projectiles. Controls are smooth and intuitive: touching and dragging on the screen moves Superman in any direction). The game consists of five rounds, each featuring a different enemy. With every new round, the enemy becomes stronger and more challenging.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Building = Container.expand(function () { var self = Container.call(this); var buildingGraphics = self.attachAsset('cityBuilding', { anchorX: 0.5, anchorY: 1.0 }); return self; }); var Cure = Container.expand(function () { var self = Container.call(this); var cureGraphics = self.attachAsset('cure', { anchorX: 0.5, anchorY: 0.5 }); self.healAmount = 25; self.floatPhase = 0; self.baseY = 0; self.glowPhase = 0; self.update = function () { // Floating animation self.floatPhase += 0.05; self.y = self.baseY + Math.sin(self.floatPhase) * 10; // Gentle glow effect self.glowPhase += 0.08; cureGraphics.alpha = 0.8 + Math.sin(self.glowPhase) * 0.2; // Slow rotation cureGraphics.rotation += 0.02; }; return self; }); var Enemy = Container.expand(function (enemyType) { var self = Container.call(this); var enemyGraphics = self.attachAsset(enemyType, { anchorX: 0.5, anchorY: 0.5 }); // Set health and damage based on enemy type with progressive difficulty var difficultyMultiplier = currentRound * 0.5; switch (enemyType) { case 'enemy1': self.health = 80 + currentRound * 20; self.damage = 20 + currentRound * 5; self.shootDelay = Math.max(30, 90 - currentRound * 10); // Gets faster each round break; case 'enemy2': self.health = 120 + currentRound * 30; self.damage = 30 + currentRound * 8; self.shootDelay = Math.max(25, 75 - currentRound * 10); break; case 'enemy3': self.health = 160 + currentRound * 40; self.damage = 40 + currentRound * 10; self.shootDelay = Math.max(20, 60 - currentRound * 8); break; case 'enemy4': self.health = 200 + currentRound * 50; self.damage = 50 + currentRound * 12; self.shootDelay = Math.max(15, 45 - currentRound * 6); break; case 'enemy5': self.health = 240 + currentRound * 60; self.damage = 60 + currentRound * 15; self.shootDelay = Math.max(10, 30 - currentRound * 4); break; } self.maxHealth = self.health; self.shootTimer = 0; self.moveDirection = 1; self.speed = 2 + currentRound * 0.5; self.isMoving = false; self.takeDamage = function (damage) { self.health -= damage; LK.effects.flashObject(self, 0xffffff, 200); if (self.health <= 0) { self.health = 0; return true; // Enemy destroyed } return false; }; self.update = function () { // Active movement patterns based on round if (!self.isMoving && Math.random() < 0.02 + currentRound * 0.005) { self.isMoving = true; var movementPattern = Math.floor(Math.random() * 3); switch (movementPattern) { case 0: // Vertical movement var newY = 200 + Math.random() * 1300; tween(self, { y: newY }, { duration: 1000 + Math.random() * 1000, easing: tween.easeInOut, onFinish: function onFinish() { self.isMoving = false; } }); break; case 1: // Horizontal movement var newX = Math.max(1200, Math.min(1900, self.x + (Math.random() - 0.5) * 400)); tween(self, { x: newX }, { duration: 800 + Math.random() * 800, easing: tween.easeInOut, onFinish: function onFinish() { self.isMoving = false; } }); break; case 2: // Diagonal movement var newX = Math.max(1200, Math.min(1900, self.x + (Math.random() - 0.5) * 300)); var newY = 200 + Math.random() * 1300; tween(self, { x: newX, y: newY }, { duration: 1200 + Math.random() * 800, easing: tween.easeInOut, onFinish: function onFinish() { self.isMoving = false; } }); break; } } // Basic movement fallback self.y += self.moveDirection * self.speed; if (self.y < 200 || self.y > 1500) { self.moveDirection *= -1; } // Shoot at Superman with increased frequency self.shootTimer++; if (self.shootTimer >= self.shootDelay) { self.shootTimer = 0; self.shoot(); } }; self.shoot = function () { var bulletSpeed = 8 + currentRound * 2; var bulletCount = currentRound >= 3 ? 2 : 1; // Determine bullet type based on enemy type var BulletClass; switch (enemyType) { case 'enemy1': BulletClass = EnemyBullet1; break; case 'enemy2': BulletClass = EnemyBullet2; break; case 'enemy3': BulletClass = EnemyBullet3; break; case 'enemy4': BulletClass = EnemyBullet4; break; case 'enemy5': BulletClass = EnemyBullet5; break; default: BulletClass = EnemyBullet1; } for (var b = 0; b < bulletCount; b++) { var bullet = new BulletClass(); bullet.x = self.x - 50; bullet.y = self.y + (b * 40 - 20); bullet.damage = self.damage; // Special handling for wave bullets (enemy3) if (enemyType === 'enemy3') { bullet.originalY = bullet.y; } // Calculate direction to Superman var dx = superman.x - bullet.x; var dy = superman.y - bullet.y; var distance = Math.sqrt(dx * dx + dy * dy); // Add spread for multiple bullets if (bulletCount > 1) { var spreadAngle = (b - 0.5) * 0.3; var cos = Math.cos(spreadAngle); var sin = Math.sin(spreadAngle); var tempX = dx * cos - dy * sin; var tempY = dx * sin + dy * cos; dx = tempX; dy = tempY; distance = Math.sqrt(dx * dx + dy * dy); } // Normalize direction and set velocity (except for wave bullets) if (enemyType !== 'enemy3') { bullet.velocityX = dx / distance * bulletSpeed; bullet.velocityY = dy / distance * bulletSpeed; } else { bullet.velocityX = dx / distance * bulletSpeed; bullet.velocityY = 0; // Wave bullets don't use velocityY } enemyBullets.push(bullet); game.addChild(bullet); } LK.getSound('enemyShoot').play(); }; return self; }); var EnemyBullet1 = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet1', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = -8; self.velocityY = 0; self.damage = 10; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; }; return self; }); var EnemyBullet2 = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet2', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = -8; self.velocityY = 0; self.damage = 15; self.rotationSpeed = 0.1; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; bulletGraphics.rotation += self.rotationSpeed; }; return self; }); var EnemyBullet3 = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet3', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = -8; self.velocityY = 0; self.damage = 20; self.wavePhase = 0; self.waveAmplitude = 100; self.originalY = 0; self.update = function () { self.x += self.velocityX; self.wavePhase += 0.2; self.y = self.originalY + Math.sin(self.wavePhase) * self.waveAmplitude; }; return self; }); var EnemyBullet4 = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet4', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = -8; self.velocityY = 0; self.damage = 25; self.pulsePhase = 0; self.baseScale = 1; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.pulsePhase += 0.3; var scale = self.baseScale + Math.sin(self.pulsePhase) * 0.3; bulletGraphics.scale.set(scale, scale); }; return self; }); var EnemyBullet5 = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet5', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = -8; self.velocityY = 0; self.damage = 30; self.acceleration = 0.2; self.rotationSpeed = 0.15; self.update = function () { self.velocityX -= self.acceleration; self.velocityY += (Math.random() - 0.5) * 0.5; self.x += self.velocityX; self.y += self.velocityY; bulletGraphics.rotation += self.rotationSpeed; }; return self; }); var HeatVision = Container.expand(function () { var self = Container.call(this); var heatGraphics = self.attachAsset('heatVision', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.damage = 20; self.update = function () { self.x += self.speed; }; return self; }); var Moon = Container.expand(function () { var self = Container.call(this); var moonGraphics = self.attachAsset('moon', { anchorX: 0.5, anchorY: 0.5 }); moonGraphics.alpha = 0.9; self.glowPhase = 0; self.update = function () { // Subtle glow effect self.glowPhase += 0.01; moonGraphics.alpha = 0.8 + Math.sin(self.glowPhase) * 0.1; }; return self; }); var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('star', { anchorX: 0.5, anchorY: 0.5 }); self.baseAlpha = 0.3 + Math.random() * 0.7; self.twinkleSpeed = 0.02 + Math.random() * 0.03; self.twinklePhase = Math.random() * Math.PI * 2; self.update = function () { // Twinkling effect self.twinklePhase += self.twinkleSpeed; starGraphics.alpha = self.baseAlpha + Math.sin(self.twinklePhase) * 0.3; }; return self; }); var Superman = Container.expand(function () { var self = Container.call(this); var supermanGraphics = self.attachAsset('superman', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.shootCooldown = 0; self.invulnerable = false; self.invulnerableTime = 0; self.takeDamage = function (damage) { if (self.invulnerable) return; self.health -= damage; self.invulnerable = true; self.invulnerableTime = 60; // 1 second at 60fps // Flash red when taking damage LK.effects.flashObject(self, 0xff0000, 500); LK.getSound('hit').play(); if (self.health <= 0) { self.health = 0; gameOver = true; } }; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } if (self.invulnerableTime > 0) { self.invulnerableTime--; if (self.invulnerableTime <= 0) { self.invulnerable = false; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0f0f23 }); /**** * Game Code ****/ var superman = null; var heatVisionBeams = []; var enemies = []; var enemyBullets = []; var buildings = []; var stars = []; var moon = null; var currentRound = 1; var maxRounds = 5; var gameOver = false; var roundComplete = false; var dragNode = null; var cures = []; // Enemy types for each round var enemyTypes = ['enemy1', 'enemy2', 'enemy3', 'enemy4', 'enemy5']; // Create night sky gradient background var skyGradient = LK.getAsset('heatVision', { anchorX: 0, anchorY: 0, scaleX: 34, scaleY: 228 }); skyGradient.x = 0; skyGradient.y = 0; skyGradient.alpha = 0.3; skyGradient.tint = 0x1a1a3a; game.addChild(skyGradient); // Create stars for (var i = 0; i < 80; i++) { var star = new Star(); star.x = Math.random() * 2048; star.y = Math.random() * 1000; stars.push(star); game.addChild(star); } // Create moon moon = new Moon(); moon.x = 1700; moon.y = 300; game.addChild(moon); // Create city background for (var i = 0; i < 12; i++) { var building = new Building(); building.x = i * 180; building.y = 2732; building.alpha = 0.3; buildings.push(building); game.addChild(building); } // Create Superman superman = new Superman(); superman.x = 300; superman.y = 1366; game.addChild(superman); // Create UI elements var roundText = new Text2('Round: 1', { size: 60, fill: 0xFFFFFF }); roundText.anchor.set(0.5, 0); LK.gui.top.addChild(roundText); var healthText = new Text2('Health: 100', { size: 50, fill: 0xFFFFFF }); healthText.anchor.set(0, 0); healthText.x = 120; healthText.y = 10; LK.gui.topLeft.addChild(healthText); var scoreText = new Text2('Score: 0', { size: 50, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); // Start first round function startRound() { if (currentRound > maxRounds) { LK.showYouWin(); return; } roundComplete = false; var enemy = new Enemy(enemyTypes[currentRound - 1]); enemy.x = 1800; enemy.y = 800; enemies.push(enemy); game.addChild(enemy); roundText.setText('Round: ' + currentRound); // Spawn 2 cures per round for (var c = 0; c < 2; c++) { var cure = new Cure(); cure.x = 400 + Math.random() * 1200; // Random x position in playable area cure.y = 400 + Math.random() * 1200; // Random y position in playable area cure.baseY = cure.y; cures.push(cure); game.addChild(cure); } } // Touch controls game.down = function (x, y, obj) { dragNode = superman; superman.x = x; superman.y = y; // Shoot heat vision if (superman.shootCooldown <= 0) { var beam = new HeatVision(); beam.x = superman.x + 40; beam.y = superman.y; heatVisionBeams.push(beam); game.addChild(beam); superman.shootCooldown = 15; // 0.25 seconds LK.getSound('shoot').play(); } }; game.move = function (x, y, obj) { if (dragNode) { dragNode.x = x; dragNode.y = y; } }; game.up = function (x, y, obj) { dragNode = null; }; // Initialize first round startRound(); game.update = function () { if (gameOver) { LK.showGameOver(); return; } // Update health display healthText.setText('Health: ' + superman.health); scoreText.setText('Score: ' + LK.getScore()); // Check if round is complete if (enemies.length === 0 && !roundComplete) { roundComplete = true; currentRound++; LK.setTimeout(function () { startRound(); }, 2000); } // Update heat vision beams for (var i = heatVisionBeams.length - 1; i >= 0; i--) { var beam = heatVisionBeams[i]; // Remove if off screen if (beam.x > 2100) { beam.destroy(); heatVisionBeams.splice(i, 1); continue; } // Check collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (beam.intersects(enemy)) { var destroyed = enemy.takeDamage(beam.damage); beam.destroy(); heatVisionBeams.splice(i, 1); if (destroyed) { LK.setScore(LK.getScore() + 100); // 30% chance to spawn a cure after enemy destruction if (Math.random() < 0.3) { var cure = new Cure(); cure.x = enemy.x; cure.y = enemy.y; cure.baseY = enemy.y; cures.push(cure); game.addChild(cure); } enemy.destroy(); enemies.splice(j, 1); } break; } } } // Update enemy bullets for (var i = enemyBullets.length - 1; i >= 0; i--) { var bullet = enemyBullets[i]; // Remove if off screen if (bullet.x < -100 || bullet.x > 2148 || bullet.y < -100 || bullet.y > 2832) { bullet.destroy(); enemyBullets.splice(i, 1); continue; } // Check collision with Superman if (bullet.intersects(superman)) { superman.takeDamage(bullet.damage); // 20% chance to spawn a cure after Superman gets hit if (Math.random() < 0.2) { var cure = new Cure(); cure.x = superman.x + (Math.random() - 0.5) * 200; cure.y = superman.y + (Math.random() - 0.5) * 200; cure.baseY = cure.y; cures.push(cure); game.addChild(cure); } bullet.destroy(); enemyBullets.splice(i, 1); } } // Update cures for (var i = cures.length - 1; i >= 0; i--) { var cure = cures[i]; // Remove if off screen if (cure.x < -100 || cure.x > 2148 || cure.y < -100 || cure.y > 2832) { cure.destroy(); cures.splice(i, 1); continue; } // Check collision with Superman if (cure.intersects(superman)) { // Heal Superman but don't exceed max health superman.health = Math.min(superman.maxHealth, superman.health + cure.healAmount); LK.effects.flashObject(superman, 0x00ff00, 300); // Green flash for healing LK.getSound('heal').play(); cure.destroy(); cures.splice(i, 1); } } // Update night sky elements for (var i = 0; i < stars.length; i++) { stars[i].update(); } if (moon) { moon.update(); } // Keep Superman within bounds if (superman.x < 40) superman.x = 40; if (superman.x > 2008) superman.x = 2008; if (superman.y < 60) superman.y = 60; if (superman.y > 2672) superman.y = 2672; };
===================================================================
--- original.js
+++ change.js
@@ -479,8 +479,17 @@
enemy.y = 800;
enemies.push(enemy);
game.addChild(enemy);
roundText.setText('Round: ' + currentRound);
+ // Spawn 2 cures per round
+ for (var c = 0; c < 2; c++) {
+ var cure = new Cure();
+ cure.x = 400 + Math.random() * 1200; // Random x position in playable area
+ cure.y = 400 + Math.random() * 1200; // Random y position in playable area
+ cure.baseY = cure.y;
+ cures.push(cure);
+ game.addChild(cure);
+ }
}
// Touch controls
game.down = function (x, y, obj) {
dragNode = superman;
Superman 2d game. In-Game asset. 2d. High contrast. No shadows
City building 2d game long and grey with windows. In-Game asset. 2d. High contrast
Aggressive strong big robot 2d game right side. In-Game asset. 2d. High contrast. No shadows
Mad strong person like the joker 2d game. In-Game asset. 2d. High contrast. No shadows
Savage alien strong 2d game. In-Game asset. 2d. High contrast. No shadows
Mad strong wizard dc world 2d game. In-Game asset. 2d. High contrast. No shadows
Dark superman 2d game. In-Game asset. 2d. High contrast. No shadows
Robot bullet 2d game. In-Game asset. 2d. High contrast. No shadows
Knife 2d game. In-Game asset. 2d. High contrast. No shadows
Thunder 2d game. In-Game asset. 2d. High contrast. No shadows
Superhero heal. In-Game asset. 2d. High contrast. No shadows