User prompt
Genel olarak son kez optimize et animasyonları geliştir hataları düzelt ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menü daha gelişmiş bir temaya sahip olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'RangeError: Maximum call stack size exceeded' in or related to this line: 'moonGlow();' Line Number: 767 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Gündüz görünümü ve gece görünümünü birazdaha geliştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Düşmanlardan azda olsa kan fışkırsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Error: Error: Invalid color format. Expected 0xRRGGBB format, received: -1908225' in or related to this line: 'tween(laser, {' Line Number: 1325 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyun içi animasyonları birazdaha geliştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menüdeki animasyonları ve oyun içi animasyonları birazdaha geliştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menüdeki animasyonu birazdaha geliştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bug ve hataları düzelt
User prompt
En son yaptığın şeyi düzenle
User prompt
Sultan bize düşman oldu modunda score puanı sadece 10 yap
User prompt
Gece ve gündüz modunda score puanına ulaştığım zaman sultan ile buluşuyum ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Eğer düşman bizim kalemezi geçerse oyunu kaybedelim
User prompt
Lazer bir düşman öldürdüğünde 5 enemies puanı versin
User prompt
Lazer bir düşmanı öldürdüğü 5 score puanı ver
User prompt
My Sultan Yazısı büyük ve gelişmiş havalı sultan renklerine uygun olarak tasarla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Menüde küçük bir animasyon yap ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Lazerin düşmanı öldürme özelliği olsun
User prompt
Lazer bir düşmanı öldürürse 5 score getirsin
User prompt
Lazer atma seçeneği olsun başkahramanda
User prompt
Kaleyi ve yolu geri getir
User prompt
Kaleyi kaldır
User prompt
Başkarekterin bir 🏰 si olsun
User prompt
Score 90 olduktan sonra çok daha fazla gelen düşman olsun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BloodParticle = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('confetti', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0xFF0000; // Red color for blood graphics.scaleX = 0.3; // Smaller particles graphics.scaleY = 0.3; self.speedX = (Math.random() - 0.5) * 6; self.speedY = Math.random() * -4 - 1; self.gravity = 0.2; self.life = 30; // Short lived particles self.update = function () { self.x += self.speedX; self.y += self.speedY; self.speedY += self.gravity; self.life--; if (self.life <= 0) { self.alpha = 0; } else { // Fade out over time self.alpha = self.life / 30; } }; return self; }); var Confetti = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('confetti', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = (Math.random() - 0.5) * 10; self.speedY = Math.random() * -8 - 2; self.gravity = 0.3; self.life = 120; self.update = function () { self.x += self.speedX; self.y += self.speedY; self.speedY += self.gravity; self.life--; if (self.life <= 0) { self.alpha = 0; } }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); self.enemyType = 'aamir'; self.health = 1; self.speed = 2; self.init = function (type) { self.enemyType = type; if (type === 'vega') { self.health = 3; self.speed = 1; } else if (type === 'sultan') { self.health = 2; self.speed = 1.5; } var graphics = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5 }); }; self.update = function () { self.y += self.speed; }; self.takeDamage = function () { self.health--; if (self.health <= 0) { return true; } return false; }; return self; }); var Laser = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('laser', { anchorX: 0.5, anchorY: 1.0 }); self.duration = 20; // Laser lasts for 20 frames self.damage = 5; // Higher damage than regular bullets self.update = function () { self.duration--; if (self.duration <= 0) { self.alpha = 0; } else { // Fade out effect self.alpha = self.duration / 20; } }; return self; }); var ModeButton = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('modeButton', { anchorX: 0.5, anchorY: 0.5 }); self.modeText = new Text2('', { size: 50, fill: '#000000' }); self.modeText.anchor.set(0.5, 0.5); self.addChild(self.modeText); self.setMode = function (text, mode, enemyCount) { // Remove existing text and create new one with proper styling if (self.modeText) { self.removeChild(self.modeText); } self.modeText = new Text2(text, { size: 50, fill: '#000000', stroke: '#FFFFFF', strokeThickness: 3 }); self.modeText.anchor.set(0.5, 0); self.modeText.y = 80; // Position text below the button self.addChild(self.modeText); self.gameMode = mode; self.enemyCount = enemyCount; }; self.down = function (x, y, obj) { startGame(self.gameMode, self.enemyCount); }; return self; }); var Omar = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('omar', { anchorX: 0.5, anchorY: 0.5 }); self.shootCooldown = 0; self.laserCooldown = 0; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } if (self.laserCooldown > 0) { self.laserCooldown--; } }; self.shoot = function () { if (self.shootCooldown <= 0) { var bullet = new OmarBullet(); bullet.x = self.x; bullet.y = self.y - 40; bullets.push(bullet); game.addChild(bullet); self.shootCooldown = 15; LK.getSound('shoot').play(); } }; self.shootLaser = function () { if (self.laserCooldown <= 0) { var laser = new Laser(); laser.x = self.x; laser.y = self.y - 40; lasers.push(laser); game.addChild(laser); self.laserCooldown = 60; // 1 second cooldown at 60fps LK.getSound('shoot').play(); } }; return self; }); var OmarAI = Container.expand(function () { var self = Container.call(this); self.target = null; self.isActive = false; self.moveSpeed = 3; self.attackRange = 400; self.lastDecisionTime = 0; self.decisionCooldown = 30; // frames between AI decisions self.activate = function () { self.isActive = true; }; self.deactivate = function () { self.isActive = false; }; self.findNearestEnemy = function () { var nearestEnemy = null; var nearestDistance = Infinity; for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; var dx = omar.x - enemy.x; var dy = omar.y - enemy.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestEnemy = enemy; } } return nearestEnemy; }; self.update = function () { if (!self.isActive || !omar) return; self.lastDecisionTime++; // Make decisions every few frames for performance if (self.lastDecisionTime >= self.decisionCooldown) { self.target = self.findNearestEnemy(); self.lastDecisionTime = 0; } if (self.target) { // Move towards enemy horizontally var dx = self.target.x - omar.x; if (Math.abs(dx) > 50) { // Dead zone to prevent jittering if (dx > 0) { omar.x += self.moveSpeed; } else { omar.x -= self.moveSpeed; } } // Keep Omar within screen bounds with proper margins omar.x = Math.max(95, Math.min(1953, omar.x)); // Shoot if enemy is within range var distance = Math.sqrt(dx * dx + (self.target.y - omar.y) * (self.target.y - omar.y)); if (distance < self.attackRange) { omar.shoot(); } } }; return self; }); var OmarBullet = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('omarBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -8; self.update = function () { self.y += self.speed; }; return self; }); var Terrain = Container.expand(function () { var self = Container.call(this); self.init = function (type, x, y) { var graphics = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5 }); self.x = x; self.y = y; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000033 }); /**** * Game Code ****/ // Game state // Hero assets // Enemy assets // UI assets // Sound assets var gameState = 'menu'; // 'menu', 'playing', 'victory' var currentMode = ''; var enemiesRequired = 0; var enemiesKilled = 0; var gameStarted = false; // Game objects var omar; var omarAI; var bullets = []; var enemies = []; var confettiParticles = []; var bloodParticles = []; var terrainElements = []; var lasers = []; // UI elements var titleText; var scoreText; var modeButtons = []; // Enemy spawn timer - optimized for performance var enemySpawnTimer = 0; var enemySpawnRate = 60; // frames between spawns - faster to compensate for limited enemies // Initialize menu function initMenu() { gameState = 'menu'; // Title - Enhanced Sultan Style titleText = new Text2('My Sultan', { size: 120, fill: '#FFD700', // Gold stroke: '#8B0000', // Dark red stroke strokeThickness: 8, dropShadow: true, dropShadowColor: '#000000', dropShadowDistance: 5, dropShadowAngle: Math.PI / 4 }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 400; game.addChild(titleText); // Add floating animation to title with enhanced effects tween(titleText, { y: 380, rotation: 0.05 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { // Create continuous floating effect with rotation function floatUp() { tween(titleText, { y: 380, rotation: 0.05 }, { duration: 2000, easing: tween.easeInOut, onFinish: floatDown }); } function floatDown() { tween(titleText, { y: 420, rotation: -0.05 }, { duration: 2000, easing: tween.easeInOut, onFinish: floatUp }); } floatDown(); } }); // Add enhanced pulsing color effect with magical transitions function createColorPulse() { tween(titleText, { tint: 0xFFB347 // Orange-gold tint }, { duration: 1200, easing: tween.elasticOut, onFinish: function onFinish() { tween(titleText, { tint: 0xFF6B35 // Deeper orange }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(titleText, { tint: 0xFFD700 // Back to gold }, { duration: 1000, easing: tween.bounceOut, onFinish: createColorPulse }); } }); } }); } createColorPulse(); // Add enhanced scale pulsing with glow effect function createScalePulse() { tween(titleText, { scaleX: 1.15, scaleY: 1.15, alpha: 0.9 }, { duration: 2000, easing: tween.elasticInOut, onFinish: function onFinish() { tween(titleText, { scaleX: 1.0, scaleY: 1.0, alpha: 1.0 }, { duration: 2000, easing: tween.bounceOut, onFinish: createScalePulse }); } }); } createScalePulse(); // Subtitle with enhanced effects var subtitle = new Text2('Choose Your Quest', { size: 50, fill: '#FFFFFF', stroke: '#FFD700', strokeThickness: 2 }); subtitle.anchor.set(0.5, 0.5); subtitle.x = 1024; subtitle.y = 500; subtitle.alpha = 0; subtitle.scaleX = 0.5; subtitle.scaleY = 0.5; game.addChild(subtitle); // Animate subtitle entrance LK.setTimeout(function () { tween(subtitle, { alpha: 1, scaleX: 1.0, scaleY: 1.0 }, { duration: 1500, easing: tween.elasticOut }); }, 1000); // Add subtle floating animation to subtitle function subtitleFloat() { tween(subtitle, { y: 490, rotation: 0.01 }, { duration: 3000, easing: tween.easeInOut, onFinish: function onFinish() { tween(subtitle, { y: 510, rotation: -0.01 }, { duration: 3000, easing: tween.easeInOut, onFinish: subtitleFloat }); } }); } LK.setTimeout(subtitleFloat, 2000); // Add color cycling effect to subtitle function subtitleColorCycle() { tween(subtitle, { tint: 0xE6E6FA }, { duration: 2500, easing: tween.easeInOut, onFinish: function onFinish() { tween(subtitle, { tint: 0xFFFFFF }, { duration: 2500, easing: tween.easeInOut, onFinish: subtitleColorCycle }); } }); } LK.setTimeout(subtitleColorCycle, 1500); // Mode buttons with enhanced animations var nightButton = new ModeButton(); nightButton.setMode('Night Mode (100 enemies)', 'night', 100); nightButton.x = 1024; nightButton.y = 800; nightButton.alpha = 0; modeButtons.push(nightButton); game.addChild(nightButton); // Animate night button entrance tween(nightButton, { alpha: 1, scaleX: 1.0, scaleY: 1.0 }, { duration: 1000, easing: tween.bounceOut }); // Add continuous glow effect to night button function nightButtonGlow() { tween(nightButton, { tint: 0x4169E1, scaleX: 1.05, scaleY: 1.05 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(nightButton, { tint: 0xFFFFFF, scaleX: 1.0, scaleY: 1.0 }, { duration: 1500, easing: tween.easeInOut, onFinish: nightButtonGlow }); } }); } LK.setTimeout(nightButtonGlow, 500); var dayButton = new ModeButton(); dayButton.setMode('Day Mode (100 enemies)', 'day', 100); dayButton.x = 1024; dayButton.y = 1000; dayButton.alpha = 0; modeButtons.push(dayButton); game.addChild(dayButton); // Animate day button entrance with delay LK.setTimeout(function () { tween(dayButton, { alpha: 1, scaleX: 1.0, scaleY: 1.0 }, { duration: 1000, easing: tween.bounceOut }); }, 300); // Add continuous glow effect to day button function dayButtonGlow() { tween(dayButton, { tint: 0xFFD700, scaleX: 1.05, scaleY: 1.05 }, { duration: 1800, easing: tween.easeInOut, onFinish: function onFinish() { tween(dayButton, { tint: 0xFFFFFF, scaleX: 1.0, scaleY: 1.0 }, { duration: 1800, easing: tween.easeInOut, onFinish: dayButtonGlow }); } }); } LK.setTimeout(dayButtonGlow, 800); var betrayalButton = new ModeButton(); betrayalButton.setMode('My Sultan Became My Enemy (400)', 'betrayal', 400); betrayalButton.x = 1024; betrayalButton.y = 1200; betrayalButton.alpha = 0; modeButtons.push(betrayalButton); game.addChild(betrayalButton); // Animate betrayal button entrance with longer delay LK.setTimeout(function () { tween(betrayalButton, { alpha: 1, scaleX: 1.0, scaleY: 1.0 }, { duration: 1000, easing: tween.bounceOut }); }, 600); // Add continuous dramatic glow effect to betrayal button function betrayalButtonGlow() { tween(betrayalButton, { tint: 0xFF4500, scaleX: 1.08, scaleY: 1.08, rotation: 0.02 }, { duration: 1200, easing: tween.easeInOut, onFinish: function onFinish() { tween(betrayalButton, { tint: 0xFFFFFF, scaleX: 1.0, scaleY: 1.0, rotation: -0.02 }, { duration: 1200, easing: tween.easeInOut, onFinish: betrayalButtonGlow }); } }); } LK.setTimeout(betrayalButtonGlow, 1100); } function startGame(mode, enemyCount) { gameState = 'playing'; currentMode = mode; enemiesRequired = enemyCount; enemiesKilled = 0; gameStarted = true; // Clear menu while (game.children.length > 0) { var child = game.children[0]; child.destroy(); } // Set background based on mode if (mode === 'night') { game.setBackgroundColor(0x000033); } else if (mode === 'day') { game.setBackgroundColor(0x87CEEB); } else if (mode === 'betrayal') { game.setBackgroundColor(0x8B0000); } // Create Omar omar = new Omar(); omar.x = 1024; omar.y = 2200; // Position Omar on the road game.addChild(omar); // Create and activate AI omarAI = new OmarAI(); omarAI.activate(); game.addChild(omarAI); // Generate terrain for the mode generateTerrain(mode); // Create score text scoreText = new Text2('Enemies: 0 / ' + enemiesRequired, { size: 60, fill: '#FFFFFF' }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Reset arrays bullets = []; enemies = []; confettiParticles = []; bloodParticles = []; terrainElements = []; lasers = []; // Reset spawn timer enemySpawnTimer = 0; // After score 90, spawn enemies much more frequently if (enemiesKilled >= 90) { enemySpawnRate = Math.max(10, 30 - Math.floor((enemiesKilled - 90) / 10) * 5); } else { enemySpawnRate = Math.max(30, 90 - Math.floor(enemiesKilled / 20) * 10); } } function generateTerrain(mode) { // Clear existing terrain for (var i = terrainElements.length - 1; i >= 0; i--) { terrainElements[i].destroy(); } terrainElements = []; // Add road in the center var road = new Terrain(); road.init('road', 1024, 1366); terrainElements.push(road); game.addChild(road); // Add castle at the top var castle = new Terrain(); castle.init('castle', 1024, 300); terrainElements.push(castle); game.addChild(castle); // Add some decorative terrain elements based on mode if (mode === 'day') { // Add some stones and dirt for day mode for (var i = 0; i < 8; i++) { var terrain = new Terrain(); var type = Math.random() > 0.5 ? 'stone' : 'dirt'; terrain.init(type, Math.random() * 1700 + 174, Math.random() * 2000 + 400); terrainElements.push(terrain); game.addChild(terrain); } } else if (mode === 'night') { // Add fewer, darker terrain for night mode for (var i = 0; i < 5; i++) { var terrain = new Terrain(); terrain.init('stone', Math.random() * 1700 + 174, Math.random() * 2000 + 400); terrainElements.push(terrain); game.addChild(terrain); } } else if (mode === 'betrayal') { // Add strategic terrain for betrayal mode for (var i = 0; i < 10; i++) { var terrain = new Terrain(); var type = Math.random() > 0.3 ? 'stone' : 'dirt'; terrain.init(type, Math.random() * 1700 + 174, Math.random() * 2000 + 400); terrainElements.push(terrain); game.addChild(terrain); } } } function spawnEnemy() { var enemy = new Enemy(); // Determine enemy type based on mode and progress var enemyType = 'aamir'; var progress = enemiesKilled / enemiesRequired; if (currentMode === 'betrayal') { if (Math.random() < 0.3) { enemyType = 'sultan'; } else if (progress > 0.7 && Math.random() < 0.2) { enemyType = 'vega'; } } else { if (progress > 0.8 && Math.random() < 0.15) { enemyType = 'vega'; } } enemy.init(enemyType); enemy.x = Math.random() * 1700 + 174; // Better bounds to keep enemies visible enemy.y = -50; enemies.push(enemy); game.addChild(enemy); } function checkVictory() { // Check for sultan meeting in night and day modes at score 50 if ((currentMode === 'night' || currentMode === 'day') && enemiesKilled >= 50 && gameState !== 'sultanMeeting') { gameState = 'sultanMeeting'; LK.getSound('victory').play(); // Create sultan character var sultanChar = new Terrain(); sultanChar.init('sultan', 1024, 1366); game.addChild(sultanChar); tween(sultanChar, { scaleX: 10, scaleY: 10 }, { duration: 2000, easing: tween.easeOut }); // Sultan meeting text var meetingText = new Text2('My Sultan Arrives!', { size: 80, fill: '#FFD700', stroke: '#8B0000', strokeThickness: 4 }); meetingText.anchor.set(0.5, 0.5); meetingText.x = 1024; meetingText.y = 800; game.addChild(meetingText); tween(meetingText, { scaleX: 1.2, scaleY: 1.2, tint: 0xFFB347 }, { duration: 1000, easing: tween.easeInOut }); // Create golden confetti for sultan meeting for (var i = 0; i < 30; i++) { var confetti = new Confetti(); confetti.x = Math.random() * 2048; confetti.y = Math.random() * 500 + 500; confetti.tint = 0xFFD700; // Golden confetti for sultan confettiParticles.push(confetti); game.addChild(confetti); } // Continue game after sultan meeting LK.setTimeout(function () { gameState = 'playing'; meetingText.destroy(); sultanChar.destroy(); }, 3000); return; } // Check for sultan meeting in betrayal mode at exactly 10 enemies killed if (currentMode === 'betrayal' && enemiesKilled === 10 && gameState !== 'sultanMeeting') { gameState = 'sultanMeeting'; LK.getSound('victory').play(); // Create sultan character var sultanChar = new Terrain(); sultanChar.init('sultan', 1024, 1366); game.addChild(sultanChar); tween(sultanChar, { scaleX: 10, scaleY: 10 }, { duration: 2000, easing: tween.easeOut }); // Sultan betrayal meeting text var meetingText = new Text2('The Sultan Has Turned Against Us!', { size: 70, fill: '#FF0000', stroke: '#8B0000', strokeThickness: 4 }); meetingText.anchor.set(0.5, 0.5); meetingText.x = 1024; meetingText.y = 800; game.addChild(meetingText); tween(meetingText, { scaleX: 1.2, scaleY: 1.2, tint: 0xFF4500 }, { duration: 1000, easing: tween.easeInOut }); // Create red confetti for betrayal meeting for (var i = 0; i < 30; i++) { var confetti = new Confetti(); confetti.x = Math.random() * 2048; confetti.y = Math.random() * 500 + 500; confetti.tint = 0xFF0000; // Red confetti for betrayal confettiParticles.push(confetti); game.addChild(confetti); } // Continue game after sultan meeting LK.setTimeout(function () { gameState = 'playing'; meetingText.destroy(); sultanChar.destroy(); }, 3000); return; } if (enemiesKilled >= enemiesRequired) { gameState = 'victory'; LK.getSound('victory').play(); // Create optimized confetti (reduced count for performance) for (var i = 0; i < 20; i++) { var confetti = new Confetti(); confetti.x = Math.random() * 2048; confetti.y = Math.random() * 500 + 500; // Random colors for confetti var colors = [0xFFD700, 0xFF1493, 0x00FF00, 0x00BFFF, 0xFF4500]; confetti.tint = colors[Math.floor(Math.random() * colors.length)]; confettiParticles.push(confetti); game.addChild(confetti); } // Victory text var victoryText = new Text2('Victory! Love Conquers All!', { size: 70, fill: '#FFD700' }); victoryText.anchor.set(0.5, 0.5); victoryText.x = 1024; victoryText.y = 1366; game.addChild(victoryText); // Return to menu after 5 seconds LK.setTimeout(function () { // Clear game while (game.children.length > 0) { var child = game.children[0]; child.destroy(); } while (LK.gui.top.children.length > 0) { var child = LK.gui.top.children[0]; child.destroy(); } // Reset arrays bullets = []; enemies = []; confettiParticles = []; bloodParticles = []; terrainElements = []; lasers = []; modeButtons = []; initMenu(); }, 5000); } } // Touch controls var isTouching = false; var lastTapTime = 0; var doubleTapDelay = 300; // 300ms for double tap detection game.down = function (x, y, obj) { if (gameState === 'playing') { isTouching = true; var currentTime = Date.now(); // Check for double tap to shoot laser if (currentTime - lastTapTime < doubleTapDelay) { omar.shootLaser(); } else { omar.shoot(); } lastTapTime = currentTime; } }; game.up = function (x, y, obj) { isTouching = false; }; game.move = function (x, y, obj) { if (gameState === 'playing' && omar) { // Manual control overrides AI if (omarAI) { omarAI.deactivate(); } omar.x = Math.max(40, Math.min(2008, x)); if (isTouching) { omar.shoot(); } // Reactivate AI after a short delay LK.setTimeout(function () { if (omarAI) { omarAI.activate(); } }, 1000); } }; game.update = function () { if (gameState === 'playing') { // Spawn enemies enemySpawnTimer++; if (enemySpawnTimer >= enemySpawnRate) { spawnEnemy(); enemySpawnTimer = 0; // After score 90, spawn enemies much more frequently if (enemiesKilled >= 90) { enemySpawnRate = Math.max(10, 30 - Math.floor((enemiesKilled - 90) / 10) * 5); } else { enemySpawnRate = Math.max(30, 90 - Math.floor(enemiesKilled / 20) * 10); } } // Update bullets - remove bullets that go too far off screen for performance for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.lastY === undefined) bullet.lastY = bullet.y; // Remove bullets that are way off screen for performance if (bullet.y < -1000) { bullet.destroy(); bullets.splice(i, 1); continue; } // Optimized collision detection - only check nearby enemies var hit = false; for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; // Quick distance check before expensive intersection var dx = bullet.x - enemy.x; var dy = bullet.y - enemy.y; if (dx * dx + dy * dy < 10000 && bullet.intersects(enemy)) { if (enemy.takeDamage()) { // Create blood spray effect for (var k = 0; k < 3; k++) { var blood = new BloodParticle(); blood.x = enemy.x; blood.y = enemy.y; bloodParticles.push(blood); game.addChild(blood); } enemy.destroy(); enemies.splice(j, 1); enemiesKilled++; // Update score immediately when each enemy dies scoreText.setText('Enemies: ' + enemiesKilled + ' / ' + enemiesRequired); checkVictory(); } // Bullet continues through enemy - no destruction hit = true; break; } } if (!hit) { bullet.lastY = bullet.y; } } // Limit enemies on screen for performance - increase limit after score 90 var enemyLimit = enemiesKilled >= 90 ? 15 : 8; if (enemies.length > enemyLimit) { var oldEnemy = enemies.shift(); oldEnemy.destroy(); } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.lastY === undefined) enemy.lastY = enemy.y; // Game over if enemy passes Omar's defensive line (y > 2300) if (enemy.lastY <= 2300 && enemy.y > 2300) { LK.showGameOver(); return; } enemy.lastY = enemy.y; } // Update lasers for (var i = lasers.length - 1; i >= 0; i--) { var laser = lasers[i]; // Check laser collision with all enemies in range for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; // Check if enemy intersects with laser beam if (laser.intersects(enemy)) { // Laser instantly kills enemies regardless of health // Create blood spray effect for (var k = 0; k < 3; k++) { var blood = new BloodParticle(); blood.x = enemy.x; blood.y = enemy.y; bloodParticles.push(blood); game.addChild(blood); } enemy.destroy(); enemies.splice(j, 1); enemiesKilled += 5; // Award 5 enemies killed for laser kill // Update score immediately when each enemy dies scoreText.setText('Enemies: ' + enemiesKilled + ' / ' + enemiesRequired); checkVictory(); } } // Remove laser when duration expires if (laser.duration <= 0) { laser.destroy(); lasers.splice(i, 1); } } // Update AI if (omarAI) { omarAI.update(); } // Reduced auto shoot frequency for better performance (only when AI is not active) if (LK.ticks % 20 === 0 && (!omarAI || !omarAI.isActive)) { omar.shoot(); } } // Update confetti for (var i = confettiParticles.length - 1; i >= 0; i--) { var confetti = confettiParticles[i]; if (confetti.life <= 0) { confetti.destroy(); confettiParticles.splice(i, 1); } } // Update blood particles for (var i = bloodParticles.length - 1; i >= 0; i--) { var blood = bloodParticles[i]; if (blood.life <= 0) { blood.destroy(); bloodParticles.splice(i, 1); } } }; // Initialize the menu initMenu();
===================================================================
--- original.js
+++ change.js
@@ -317,28 +317,31 @@
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 400;
game.addChild(titleText);
- // Add floating animation to title
+ // Add floating animation to title with enhanced effects
tween(titleText, {
- y: 380
+ y: 380,
+ rotation: 0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
- // Create continuous floating effect
+ // Create continuous floating effect with rotation
function floatUp() {
tween(titleText, {
- y: 380
+ y: 380,
+ rotation: 0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: floatDown
});
}
function floatDown() {
tween(titleText, {
- y: 420
+ y: 420,
+ rotation: -0.05
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: floatUp
@@ -346,76 +349,247 @@
}
floatDown();
}
});
- // Add pulsing color effect for royal appearance
+ // Add enhanced pulsing color effect with magical transitions
function createColorPulse() {
tween(titleText, {
tint: 0xFFB347 // Orange-gold tint
}, {
- duration: 1500,
- easing: tween.easeInOut,
+ duration: 1200,
+ easing: tween.elasticOut,
onFinish: function onFinish() {
tween(titleText, {
- tint: 0xFFD700 // Back to gold
+ tint: 0xFF6B35 // Deeper orange
}, {
- duration: 1500,
+ duration: 800,
easing: tween.easeInOut,
- onFinish: createColorPulse
+ onFinish: function onFinish() {
+ tween(titleText, {
+ tint: 0xFFD700 // Back to gold
+ }, {
+ duration: 1000,
+ easing: tween.bounceOut,
+ onFinish: createColorPulse
+ });
+ }
});
}
});
}
createColorPulse();
- // Add scale pulsing for grandeur
+ // Add enhanced scale pulsing with glow effect
function createScalePulse() {
tween(titleText, {
- scaleX: 1.1,
- scaleY: 1.1
+ scaleX: 1.15,
+ scaleY: 1.15,
+ alpha: 0.9
}, {
- duration: 2500,
- easing: tween.easeInOut,
+ duration: 2000,
+ easing: tween.elasticInOut,
onFinish: function onFinish() {
tween(titleText, {
scaleX: 1.0,
- scaleY: 1.0
+ scaleY: 1.0,
+ alpha: 1.0
}, {
- duration: 2500,
- easing: tween.easeInOut,
+ duration: 2000,
+ easing: tween.bounceOut,
onFinish: createScalePulse
});
}
});
}
createScalePulse();
- // Subtitle
+ // Subtitle with enhanced effects
var subtitle = new Text2('Choose Your Quest', {
size: 50,
- fill: '#FFFFFF'
+ fill: '#FFFFFF',
+ stroke: '#FFD700',
+ strokeThickness: 2
});
subtitle.anchor.set(0.5, 0.5);
subtitle.x = 1024;
subtitle.y = 500;
+ subtitle.alpha = 0;
+ subtitle.scaleX = 0.5;
+ subtitle.scaleY = 0.5;
game.addChild(subtitle);
- // Mode buttons
+ // Animate subtitle entrance
+ LK.setTimeout(function () {
+ tween(subtitle, {
+ alpha: 1,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1500,
+ easing: tween.elasticOut
+ });
+ }, 1000);
+ // Add subtle floating animation to subtitle
+ function subtitleFloat() {
+ tween(subtitle, {
+ y: 490,
+ rotation: 0.01
+ }, {
+ duration: 3000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(subtitle, {
+ y: 510,
+ rotation: -0.01
+ }, {
+ duration: 3000,
+ easing: tween.easeInOut,
+ onFinish: subtitleFloat
+ });
+ }
+ });
+ }
+ LK.setTimeout(subtitleFloat, 2000);
+ // Add color cycling effect to subtitle
+ function subtitleColorCycle() {
+ tween(subtitle, {
+ tint: 0xE6E6FA
+ }, {
+ duration: 2500,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(subtitle, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 2500,
+ easing: tween.easeInOut,
+ onFinish: subtitleColorCycle
+ });
+ }
+ });
+ }
+ LK.setTimeout(subtitleColorCycle, 1500);
+ // Mode buttons with enhanced animations
var nightButton = new ModeButton();
nightButton.setMode('Night Mode (100 enemies)', 'night', 100);
nightButton.x = 1024;
nightButton.y = 800;
+ nightButton.alpha = 0;
modeButtons.push(nightButton);
game.addChild(nightButton);
+ // Animate night button entrance
+ tween(nightButton, {
+ alpha: 1,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1000,
+ easing: tween.bounceOut
+ });
+ // Add continuous glow effect to night button
+ function nightButtonGlow() {
+ tween(nightButton, {
+ tint: 0x4169E1,
+ scaleX: 1.05,
+ scaleY: 1.05
+ }, {
+ duration: 1500,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(nightButton, {
+ tint: 0xFFFFFF,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1500,
+ easing: tween.easeInOut,
+ onFinish: nightButtonGlow
+ });
+ }
+ });
+ }
+ LK.setTimeout(nightButtonGlow, 500);
var dayButton = new ModeButton();
dayButton.setMode('Day Mode (100 enemies)', 'day', 100);
dayButton.x = 1024;
dayButton.y = 1000;
+ dayButton.alpha = 0;
modeButtons.push(dayButton);
game.addChild(dayButton);
+ // Animate day button entrance with delay
+ LK.setTimeout(function () {
+ tween(dayButton, {
+ alpha: 1,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1000,
+ easing: tween.bounceOut
+ });
+ }, 300);
+ // Add continuous glow effect to day button
+ function dayButtonGlow() {
+ tween(dayButton, {
+ tint: 0xFFD700,
+ scaleX: 1.05,
+ scaleY: 1.05
+ }, {
+ duration: 1800,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(dayButton, {
+ tint: 0xFFFFFF,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1800,
+ easing: tween.easeInOut,
+ onFinish: dayButtonGlow
+ });
+ }
+ });
+ }
+ LK.setTimeout(dayButtonGlow, 800);
var betrayalButton = new ModeButton();
betrayalButton.setMode('My Sultan Became My Enemy (400)', 'betrayal', 400);
betrayalButton.x = 1024;
betrayalButton.y = 1200;
+ betrayalButton.alpha = 0;
modeButtons.push(betrayalButton);
game.addChild(betrayalButton);
+ // Animate betrayal button entrance with longer delay
+ LK.setTimeout(function () {
+ tween(betrayalButton, {
+ alpha: 1,
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 1000,
+ easing: tween.bounceOut
+ });
+ }, 600);
+ // Add continuous dramatic glow effect to betrayal button
+ function betrayalButtonGlow() {
+ tween(betrayalButton, {
+ tint: 0xFF4500,
+ scaleX: 1.08,
+ scaleY: 1.08,
+ rotation: 0.02
+ }, {
+ duration: 1200,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(betrayalButton, {
+ tint: 0xFFFFFF,
+ scaleX: 1.0,
+ scaleY: 1.0,
+ rotation: -0.02
+ }, {
+ duration: 1200,
+ easing: tween.easeInOut,
+ onFinish: betrayalButtonGlow
+ });
+ }
+ });
+ }
+ LK.setTimeout(betrayalButtonGlow, 1100);
}
function startGame(mode, enemyCount) {
gameState = 'playing';
currentMode = mode;
Siyah saçlı,zayıf,uzun boylu bir erkek genç. In-Game asset. 2d. High contrast. No shadows
Uzun saçlı kahverengi renkte iri bir adam. In-Game asset. 2d. High contrast. No shadows
Yaşlı bir adam kısa boylu aksakallı. In-Game asset. 2d. High contrast. No shadows
Kapalı saçlı orta ağırlıkta bir kız bir sultan çok güzel. In-Game asset. 2d. High contrast. No shadows
Dikey bir yol yap kara yolu. In-Game asset. 2d. High contrast. No shadows
Tabanca mermisi tasarla. In-Game asset. 2d. High contrast. No shadows
Mod butonu tasarla böyle tarz olsun. In-Game asset. 2d. High contrast. No shadows
Konfeti tasarla patlayan. In-Game asset. 2d. High contrast. No shadows
Taş tasarla grey. In-Game asset. 2d. High contrast. No shadows
Bir dirt tasarla. In-Game asset. 2d. High contrast. No shadows