User prompt
Oyunda her meteor veya debrisleri lazer ile vurduğumuzda 100 puan versin. Score tabelası time tabelasının altında olsun
User prompt
Oyuna arka plan müziği eklemek istiyorum
User prompt
Oyunun adını PROJECT AEGIS olarak değiştirmek istiyorum. Menü ekranında PROJECT AEGIS yazsın. Menü ekranında Play tuşuna basınca oyun başlasın
User prompt
Oyuna menü ekranı koymak istiyorum
User prompt
The level names written above should not be 1-2-3-4-5. Instead of Level 1, write Easy, Level 2, Normal, Level 3, Hard, Level 4, Insane, and Level 5, Impossible.
User prompt
Her level geçişte oyuncunun attığı lazer atma yüzde 20 artsın
User prompt
Tüm debrisler laserle vurulmadan 2. Seviyeye geçmesin. Debrisler düşme hızı yüzde 15 azalsın
User prompt
Arkaplan assetini oluştur
User prompt
Büyük meteor eğer çarparak oyun bitiyorsa büyük bir patlama oluşsun. Eğer büyük meteordan kopan parçalar sebebiyle oyun bitiyorsa daha küçük bir patlama oluşsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Arka plan oluşturmak istiyorum
User prompt
Meteordan kopan parçalar ekranın yan tarafına gitmesin ve eğer oyuncuyu geçerse oyun bitsin
User prompt
İlk meteorun canını yüzde 200 arttır
User prompt
Meteordan kopan parçalar etrafa dağılarak aşağı düşsün
User prompt
Meteorun hızını zamanlayıcı sıfıra geldiğinde ekranın yarısını kaplayacak şekilde ayarla
User prompt
meteordan çıkan parçalar daha hızlı aşağı insin.
User prompt
ilk meteorun canı yüzde 30 daha fazla olsun level yükseldikçe can yüzde 10 artsın
User prompt
meteorun düşme hızı daha yavaş olsun. Meteordan parçalar meteor vurulmadıkça gelmesin
Code edit (1 edits merged)
Please save this source code
User prompt
Meteor Defense
Initial prompt
Uzaydan gelen bir meteoru durdurmaya çalıştığımız bir oyun olucak. Oyuncu alt kısımdan lazerle ateş edecek. Ekranın üst kısmından 30 saniyede ekranın üst yarısını kaplayacak hızda kocaman bir meteor gelicek. Oyuncumuz lazer ile meteoru sürekli vuruyor olucak. Lazer meteordan her 3 saniyede bir büyük parça kopartacak. Kopan parçalar aşağıya düşecek. Oyuncunun parçalardan kaçması gerekiyor. Oyuncu parçalara çarparsa oyun biter. 30. saniyede büyük meteor tamamen parçalanacak ve 1. bölüm bitecek. Oyun 5 bölüm olacak.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Cannon = Container.expand(function () { var self = Container.call(this); var cannonGraphics = self.attachAsset('cannon', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Debris = Container.expand(function () { var self = Container.call(this); var debrisGraphics = self.attachAsset('debris', { anchorX: 0.5, anchorY: 0.5 }); self.speed = (Math.random() * 6 + 8) * 0.85; // Reduced by 15% self.horizontalSpeed = (Math.random() - 0.5) * 12; // Random horizontal movement between -6 and +6 self.rotationSpeed = (Math.random() - 0.5) * 0.2; self.update = function () { self.y += self.speed; self.x += self.horizontalSpeed; // Add horizontal movement // Keep debris within screen bounds if (self.x < 40) { self.x = 40; self.horizontalSpeed = Math.abs(self.horizontalSpeed); // Bounce off left edge } if (self.x > 2048 - 40) { self.x = 2048 - 40; self.horizontalSpeed = -Math.abs(self.horizontalSpeed); // Bounce off right edge } self.rotation += self.rotationSpeed; }; return self; }); var Explosion = Container.expand(function (explosionSize) { var self = Container.call(this); self.explosionSize = explosionSize || 200; // Default size self.particles = []; // Create explosion particles for (var i = 0; i < 15; i++) { var particle = self.attachAsset('debris', { anchorX: 0.5, anchorY: 0.5 }); particle.alpha = 0.8; particle.scaleX = 0.3; particle.scaleY = 0.3; particle.tint = Math.random() > 0.5 ? 0xff6600 : 0xff0000; var angle = i / 15 * Math.PI * 2; var speed = Math.random() * self.explosionSize + 50; particle.velocityX = Math.cos(angle) * speed; particle.velocityY = Math.sin(angle) * speed; particle.rotationSpeed = (Math.random() - 0.5) * 0.3; self.particles.push(particle); // Animate particle tween(particle, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 1500, easing: tween.easeOut }); } self.lifeTime = 0; self.update = function () { self.lifeTime++; // Move particles for (var p = 0; p < self.particles.length; p++) { var particle = self.particles[p]; particle.x += particle.velocityX * 0.016; particle.y += particle.velocityY * 0.016; particle.velocityY += 5; // Gravity particle.rotation += particle.rotationSpeed; } // Remove explosion after animation if (self.lifeTime > 90) { // 1.5 seconds at 60fps self.destroy(); } }; return self; }); var Laser = Container.expand(function () { var self = Container.call(this); var laserGraphics = self.attachAsset('laser', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -12; self.update = function () { self.y += self.speed; }; return self; }); var MenuScreen = Container.expand(function () { var self = Container.call(this); // Menu background var background = self.attachAsset('star1', { anchorX: 0.5, anchorY: 0.5, scaleX: 300, scaleY: 400 }); background.tint = 0x001122; background.alpha = 0.8; // Game title var titleText = new Text2('PROJECT AEGIS', { size: 120, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 0; titleText.y = -300; self.addChild(titleText); // Instructions var instructionsText = new Text2('Protect Earth from meteors!\nShoot meteors to break them into debris\nDestroy all debris to advance levels', { size: 50, fill: 0xAAAAAAA }); instructionsText.anchor.set(0.5, 0.5); instructionsText.x = 0; instructionsText.y = -100; self.addChild(instructionsText); // Play button background var buttonBg = self.attachAsset('cannon', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); buttonBg.tint = 0x44AA44; buttonBg.y = 200; // Play button text var playText = new Text2('PLAY', { size: 80, fill: 0xFFFFFF }); playText.anchor.set(0.5, 0.5); playText.x = 0; playText.y = 200; self.addChild(playText); // Store button reference for click detection self.playButton = buttonBg; self.down = function (x, y, obj) { // Check if play button was clicked if (self.playButton.intersects({ x: x, y: y, width: 1, height: 1 })) { startGame(); } }; return self; }); var Meteor = Container.expand(function () { var self = Container.call(this); var meteorGraphics = self.attachAsset('meteor', { anchorX: 0.5, anchorY: 0.5 }); self.health = 10; self.maxHealth = 10; self.speed = 0.5; self.lastHitTime = 0; self.update = function () { self.y += self.speed; }; self.takeDamage = function () { self.health--; self.lastHitTime = LK.ticks; LK.effects.flashObject(self, 0xff0000, 200); }; return self; }); var Star = Container.expand(function () { var self = Container.call(this); var starType = Math.floor(Math.random() * 3) + 1; var starGraphics = self.attachAsset('star' + starType, { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 2 + 1; self.twinkleSpeed = Math.random() * 0.05 + 0.02; self.twinklePhase = Math.random() * Math.PI * 2; self.update = function () { self.y += self.speed; // Twinkling effect self.twinklePhase += self.twinkleSpeed; starGraphics.alpha = 0.3 + Math.sin(self.twinklePhase) * 0.4; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000022 }); /**** * Game Code ****/ // Game state variables var currentLevel = 1; var totalLevels = 5; var gameState = 'menu'; // 'menu', 'playing', 'levelComplete', 'gameComplete' var menuScreen = null; var playButton = null; // Game objects var cannon = null; var currentMeteor = null; var lasers = []; var debrisList = []; var stars = []; // Timing variables var levelStartTime = 0; var levelDuration = 30 * 60; // 30 seconds at 60 FPS var lastDebrisSpawnTime = 0; var debrisSpawnInterval = 3 * 60; // 3 seconds at 60 FPS // UI elements var levelText = new Text2('Level 1', { size: 80, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); levelText.y = 100; var healthText = new Text2('Meteor Health: 10', { size: 60, fill: 0xFF6666 }); healthText.anchor.set(0, 0); LK.gui.topRight.addChild(healthText); healthText.x = -400; healthText.y = 100; var timeText = new Text2('Time: 30', { size: 60, fill: 0x66FF66 }); timeText.anchor.set(1, 0); LK.gui.topRight.addChild(timeText); timeText.x = -50; timeText.y = 180; // Initialize cannon cannon = game.addChild(new Cannon()); cannon.x = 2048 / 2; cannon.y = 2732 - 100; function startLevel(level) { // Reset level to 1 if starting over if (level === 1) { currentLevel = 1; } // Clear existing objects for (var i = lasers.length - 1; i >= 0; i--) { lasers[i].destroy(); lasers.splice(i, 1); } for (var j = debrisList.length - 1; j >= 0; j--) { debrisList[j].destroy(); debrisList.splice(j, 1); } if (currentMeteor) { currentMeteor.destroy(); } // Create new meteor for this level currentMeteor = game.addChild(new Meteor()); currentMeteor.x = Math.random() * (2048 - 300) + 150; currentMeteor.y = 200; // Scale meteor health and size based on level var levelMultiplier = 1 + (level - 1) * 0.5; // First meteor has 200% more health, then +10% per level var baseHealth = 10 * 3.0; // 200% more health for first meteor (triple the health) var healthMultiplier = 1 + (level - 1) * 0.1; // 10% increase per level currentMeteor.health = Math.floor(baseHealth * healthMultiplier); currentMeteor.maxHealth = currentMeteor.health; currentMeteor.scaleX = levelMultiplier; currentMeteor.scaleY = levelMultiplier; // Calculate speed to cover half screen (from y=200 to y=1366) in exactly 30 seconds var targetDistance = 2732 / 2 - 200; // Distance to cover half screen var speedPerTick = targetDistance / levelDuration; // Speed needed per tick currentMeteor.speed = speedPerTick * (1 + (level - 1) * 0.1); // Slightly faster each level // Reset timing levelStartTime = LK.ticks; lastDebrisSpawnTime = LK.ticks; // Increase laser firing rate by 20% each level (decrease fire delay) fireRate = Math.max(2, Math.floor(10 / (1 + (level - 1) * 0.2))); // Start at 10, decrease by 20% each level, minimum 2 // Update UI with descriptive level names var levelNames = ['Easy', 'Normal', 'Hard', 'Insane', 'Impossible']; var levelName = levelNames[level - 1] || 'Level ' + level; levelText.setText(levelName); healthText.setText('Meteor Health: ' + currentMeteor.health); gameState = 'playing'; } function createDebris() { if (!currentMeteor) return; var debris = game.addChild(new Debris()); debris.x = currentMeteor.x + (Math.random() - 0.5) * 200; debris.y = currentMeteor.y + 50; debrisList.push(debris); LK.getSound('debris_spawn').play(); } function fireLaser() { var laser = game.addChild(new Laser()); laser.x = cannon.x; laser.y = cannon.y - 40; lasers.push(laser); LK.getSound('laser_shoot').play(); } function createBigExplosion(x, y) { var explosion = game.addChild(new Explosion(400)); explosion.x = x; explosion.y = y; LK.effects.flashScreen(0xff4400, 1500); } function createSmallExplosion(x, y) { var explosion = game.addChild(new Explosion(200)); explosion.x = x; explosion.y = y; LK.effects.flashScreen(0xff0000, 800); } function createStar() { var star = game.addChild(new Star()); star.x = Math.random() * 2048; star.y = -10; stars.push(star); } function initializeStarfield() { // Create initial stars for (var i = 0; i < 50; i++) { var star = game.addChild(new Star()); star.x = Math.random() * 2048; star.y = Math.random() * 2732; stars.push(star); } } // Input handling var isFiring = false; var fireTimer = 0; var fireRate = 10; // Fire every 10 ticks (6 times per second) game.down = function (x, y, obj) { if (gameState === 'menu') { // Menu will handle its own clicks return; } isFiring = true; fireTimer = 0; }; game.up = function (x, y, obj) { isFiring = false; }; game.move = function (x, y, obj) { if (gameState === 'menu') return; cannon.x = x; // Keep cannon within screen bounds if (cannon.x < 60) cannon.x = 60; if (cannon.x > 2048 - 60) cannon.x = 2048 - 60; }; function showMenu() { gameState = 'menu'; // Clear any existing game objects if (currentMeteor) { currentMeteor.destroy(); currentMeteor = null; } for (var i = lasers.length - 1; i >= 0; i--) { lasers[i].destroy(); lasers.splice(i, 1); } for (var j = debrisList.length - 1; j >= 0; j--) { debrisList[j].destroy(); debrisList.splice(j, 1); } // Create menu screen menuScreen = game.addChild(new MenuScreen()); menuScreen.x = 2048 / 2; menuScreen.y = 2732 / 2; // Hide game UI levelText.alpha = 0; healthText.alpha = 0; timeText.alpha = 0; // Hide cannon if (cannon) cannon.alpha = 0; } function startGame() { gameState = 'playing'; // Remove menu screen if (menuScreen) { menuScreen.destroy(); menuScreen = null; } // Show game UI levelText.alpha = 1; healthText.alpha = 1; timeText.alpha = 1; // Show cannon if (cannon) cannon.alpha = 1; // Initialize background starfield initializeStarfield(); // Start first level startLevel(1); } // Show menu initially showMenu(); game.update = function () { if (gameState === 'menu') { // Update stars in menu for (var s = stars.length - 1; s >= 0; s--) { var star = stars[s]; // Remove stars that go off screen if (star.y > 2732 + 20) { star.destroy(); stars.splice(s, 1); } } // Create new stars periodically if (LK.ticks % 60 === 0) { createStar(); } return; } if (gameState !== 'playing') return; // Handle continuous firing if (isFiring) { fireTimer++; if (fireTimer >= fireRate) { fireLaser(); fireTimer = 0; } } // Update time display var timeRemaining = Math.max(0, Math.ceil((levelDuration - (LK.ticks - levelStartTime)) / 60)); timeText.setText('Time: ' + timeRemaining); // Check for level timeout if (LK.ticks - levelStartTime >= levelDuration) { // Time's up - game over LK.showGameOver(); return; } // Debris spawning is now handled when meteor is hit // Update and check lasers for (var i = lasers.length - 1; i >= 0; i--) { var laser = lasers[i]; // Remove lasers that go off screen if (laser.y < -50) { laser.destroy(); lasers.splice(i, 1); continue; } // Check laser-meteor collision if (currentMeteor && laser.intersects(currentMeteor)) { currentMeteor.takeDamage(); healthText.setText('Meteor Health: ' + currentMeteor.health); laser.destroy(); lasers.splice(i, 1); LK.getSound('meteor_hit').play(); // Spawn debris when meteor is hit createDebris(); // Check if meteor is destroyed if (currentMeteor.health <= 0) { currentMeteor.destroy(); currentMeteor = null; // Check if all debris are also destroyed before advancing level if (debrisList.length === 0) { // Level complete - meteor destroyed and no debris remaining currentLevel++; if (currentLevel > totalLevels) { // Game complete LK.showYouWin(); } else { // Start next level after brief delay LK.setTimeout(function () { startLevel(currentLevel); }, 1000); } } // If debris still exist, meteor is destroyed but level continues until all debris are cleared } continue; } } // Check if meteor reached cannon (big explosion) if (currentMeteor && currentMeteor.y >= cannon.y) { createBigExplosion(currentMeteor.x, currentMeteor.y); LK.setTimeout(function () { LK.showGameOver(); }, 500); return; } // Update and check debris for (var j = debrisList.length - 1; j >= 0; j--) { var debris = debrisList[j]; // Check if debris passed the cannon (game over condition) if (debris.y > cannon.y) { // Game over - debris passed the player createSmallExplosion(debris.x, debris.y); LK.setTimeout(function () { LK.showGameOver(); }, 300); return; } // Remove debris that go off screen if (debris.y > 2732 + 50) { debris.destroy(); debrisList.splice(j, 1); continue; } // Check debris-cannon collision if (debris.intersects(cannon)) { // Game over with small explosion createSmallExplosion(debris.x, debris.y); LK.setTimeout(function () { LK.showGameOver(); }, 300); return; } // Check debris-laser collision for (var k = lasers.length - 1; k >= 0; k--) { var laser = lasers[k]; if (debris.intersects(laser)) { // Destroy both debris and laser debris.destroy(); debrisList.splice(j, 1); laser.destroy(); lasers.splice(k, 1); // Check if meteor is destroyed and all debris are now cleared if (!currentMeteor && debrisList.length === 0) { // Level complete - advance to next level currentLevel++; if (currentLevel > totalLevels) { // Game complete LK.showYouWin(); } else { // Start next level after brief delay LK.setTimeout(function () { startLevel(currentLevel); }, 1000); } } break; } } } // Update and manage stars for (var s = stars.length - 1; s >= 0; s--) { var star = stars[s]; // Remove stars that go off screen if (star.y > 2732 + 20) { star.destroy(); stars.splice(s, 1); } } // Create new stars periodically if (LK.ticks % 60 === 0) { // Every second createStar(); } };
===================================================================
--- original.js
+++ change.js
@@ -111,9 +111,9 @@
});
background.tint = 0x001122;
background.alpha = 0.8;
// Game title
- var titleText = new Text2('METEOR DEFENSE', {
+ var titleText = new Text2('PROJECT AEGIS', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
moon like meteor. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Küçük meteor parçası . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
2D top-down view sci-fi laser turret, mounted on a rotating base, glowing energy cell, detailed mechanical parts, metallic finish, compact and powerful look, pixel art or vector style, no background. In-Game asset. 2d. High contrast. No shadows