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 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.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } }; 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(); } }; 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 ****/ // Sound assets // UI assets // Enemy assets // Hero assets // Game state var gameState = 'menu'; // 'menu', 'playing', 'victory' var currentMode = ''; var enemiesRequired = 0; var enemiesKilled = 0; var gameStarted = false; // Game objects var omar; var bullets = []; var enemies = []; var confettiParticles = []; var bloodParticles = []; var terrainElements = []; // 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 titleText = new Text2('My Sultan', { size: 80, fill: '#FFD700' }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 400; game.addChild(titleText); // Subtitle var subtitle = new Text2('Choose Your Quest', { size: 50, fill: '#FFFFFF' }); subtitle.anchor.set(0.5, 0.5); subtitle.x = 1024; subtitle.y = 500; game.addChild(subtitle); // Mode buttons var nightButton = new ModeButton(); nightButton.setMode('Night Mode (100 enemies)', 'night', 100); nightButton.x = 1024; nightButton.y = 800; modeButtons.push(nightButton); game.addChild(nightButton); var dayButton = new ModeButton(); dayButton.setMode('Day Mode (100 enemies)', 'day', 100); dayButton.x = 1024; dayButton.y = 1000; modeButtons.push(dayButton); game.addChild(dayButton); var betrayalButton = new ModeButton(); betrayalButton.setMode('My Sultan Became My Enemy (400)', 'betrayal', 400); betrayalButton.x = 1024; betrayalButton.y = 1200; modeButtons.push(betrayalButton); game.addChild(betrayalButton); } 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); // 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 = []; // 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 = []; // Generate only one road for all modes var road = new Terrain(); road.init('road', 1024, 2200); terrainElements.push(road); game.addChild(road); } 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() * 1800 + 124; enemy.y = -50; enemies.push(enemy); game.addChild(enemy); } function checkVictory() { 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 = []; modeButtons = []; initMenu(); }, 5000); } } // Touch controls var isTouching = false; game.down = function (x, y, obj) { if (gameState === 'playing') { isTouching = true; omar.shoot(); } }; game.up = function (x, y, obj) { isTouching = false; }; game.move = function (x, y, obj) { if (gameState === 'playing' && omar) { omar.x = Math.max(40, Math.min(2008, x)); if (isTouching) { omar.shoot(); } } }; 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 - no limit, bullets travel infinitely for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.lastY === undefined) bullet.lastY = bullet.y; // Bullets now travel infinitely - no off-screen removal // 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; // Remove enemies that go off screen (game over condition) if (enemy.lastY <= 2800 && enemy.y > 2800) { LK.showGameOver(); return; } enemy.lastY = enemy.y; } // Reduced auto shoot frequency for better performance if (LK.ticks % 20 === 0) { 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();
/****
* 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 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.update = function () {
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
};
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();
}
};
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
****/
// Sound assets
// UI assets
// Enemy assets
// Hero assets
// Game state
var gameState = 'menu'; // 'menu', 'playing', 'victory'
var currentMode = '';
var enemiesRequired = 0;
var enemiesKilled = 0;
var gameStarted = false;
// Game objects
var omar;
var bullets = [];
var enemies = [];
var confettiParticles = [];
var bloodParticles = [];
var terrainElements = [];
// 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
titleText = new Text2('My Sultan', {
size: 80,
fill: '#FFD700'
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 400;
game.addChild(titleText);
// Subtitle
var subtitle = new Text2('Choose Your Quest', {
size: 50,
fill: '#FFFFFF'
});
subtitle.anchor.set(0.5, 0.5);
subtitle.x = 1024;
subtitle.y = 500;
game.addChild(subtitle);
// Mode buttons
var nightButton = new ModeButton();
nightButton.setMode('Night Mode (100 enemies)', 'night', 100);
nightButton.x = 1024;
nightButton.y = 800;
modeButtons.push(nightButton);
game.addChild(nightButton);
var dayButton = new ModeButton();
dayButton.setMode('Day Mode (100 enemies)', 'day', 100);
dayButton.x = 1024;
dayButton.y = 1000;
modeButtons.push(dayButton);
game.addChild(dayButton);
var betrayalButton = new ModeButton();
betrayalButton.setMode('My Sultan Became My Enemy (400)', 'betrayal', 400);
betrayalButton.x = 1024;
betrayalButton.y = 1200;
modeButtons.push(betrayalButton);
game.addChild(betrayalButton);
}
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);
// 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 = [];
// 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 = [];
// Generate only one road for all modes
var road = new Terrain();
road.init('road', 1024, 2200);
terrainElements.push(road);
game.addChild(road);
}
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() * 1800 + 124;
enemy.y = -50;
enemies.push(enemy);
game.addChild(enemy);
}
function checkVictory() {
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 = [];
modeButtons = [];
initMenu();
}, 5000);
}
}
// Touch controls
var isTouching = false;
game.down = function (x, y, obj) {
if (gameState === 'playing') {
isTouching = true;
omar.shoot();
}
};
game.up = function (x, y, obj) {
isTouching = false;
};
game.move = function (x, y, obj) {
if (gameState === 'playing' && omar) {
omar.x = Math.max(40, Math.min(2008, x));
if (isTouching) {
omar.shoot();
}
}
};
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 - no limit, bullets travel infinitely
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
if (bullet.lastY === undefined) bullet.lastY = bullet.y;
// Bullets now travel infinitely - no off-screen removal
// 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;
// Remove enemies that go off screen (game over condition)
if (enemy.lastY <= 2800 && enemy.y > 2800) {
LK.showGameOver();
return;
}
enemy.lastY = enemy.y;
}
// Reduced auto shoot frequency for better performance
if (LK.ticks % 20 === 0) {
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();
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