User prompt
Babapiro mahnsı arxada çalsın
User prompt
Bossu sil monterlər əvəlki kimi doğsunlar
User prompt
bizm spavs nöqdəsini dəyişdir başa alt hissə y qoy boos gələndə bidə boss 2 vave də gəlsin
User prompt
Final bosun içində doğdum ona görə ldüm bunu necəsə fix et. bosu 10 vurusda ldürək boss 3 vave də gəlsin
User prompt
Monsterlər bizə 10 böyüklər isə 15 hasar vursun
User prompt
Russ ruletini sil final bossun mini gameləri olsun , MİNi gameləri sən elə
User prompt
4 vave də gəlsin
User prompt
Oyuna hekayə kimifinal boss əlavə etmək istəyirəm qabaq qabağa oturaq və oyun oyunuyaq RUs ruleti 4 turun başında, NEcə fikirdi
User prompt
Ulti ni ümmümiyətcə sil
User prompt
ulti açılanda ölümsüz olsun 2 saniəlik Bidə ulti açılanda 1 dənə canavarları deşən mərmi atsın bu mərmidə bullet 2 olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ulti niyəsə 8 atışdan 1 açılmır , ulti açılanda 1 dəfə deşən güllə ataq
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 12; self.directionX = 0; self.directionY = 0; self.update = function () { self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; }; return self; }); var FinalBoss = Container.expand(function () { var self = Container.call(this); var bossGraphics = self.attachAsset('strongMonster', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.health = 20; // Very strong boss self.maxHealth = 20; self.speed = 1; self.damage = 30; self.phase = 1; // Boss has 3 phases self.lastAttack = 0; self.attackCooldown = 180; // 3 seconds between attacks self.specialAttackCounter = 0; self.update = function () { if (player) { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 200) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } // Special attack pattern if (LK.ticks - self.lastAttack > self.attackCooldown) { self.specialAttack(); self.lastAttack = LK.ticks; } } }; self.specialAttack = function () { self.specialAttackCounter++; // Every 4th attack is Russian roulette if (self.specialAttackCounter % 4 === 0) { self.russianRoulette(); } else { self.normalAttack(); } }; self.normalAttack = function () { // Spawn multiple bullets in a circle pattern for (var i = 0; i < 8; i++) { var angle = i / 8 * Math.PI * 2; var bullet = new Bullet(); bullet.x = self.x; bullet.y = self.y; bullet.directionX = Math.cos(angle); bullet.directionY = Math.sin(angle); bullet.speed = 8; bullets.push(bullet); game.addChild(bullet); } }; self.russianRoulette = function () { // 4 chambers: 1 empty (safe), 3 with bullets (damage) var chamber = Math.floor(Math.random() * 4); if (chamber === 0) { // Safe chamber - boss takes damage self.health -= 3; LK.effects.flashObject(self, 0x00ff00, 1000); } else { // Bullet chamber - player takes damage player.health -= 40; LK.effects.flashObject(player, 0xff0000, 1000); LK.getSound('playerHit').play(); } }; self.takeDamage = function (damage) { self.health -= damage; // Change phase based on health if (self.health <= 15 && self.phase === 1) { self.phase = 2; self.speed = 1.5; self.attackCooldown = 150; } else if (self.health <= 10 && self.phase === 2) { self.phase = 3; self.speed = 2; self.attackCooldown = 120; } }; return self; }); var Monster = Container.expand(function () { var self = Container.call(this); var monsterGraphics = self.attachAsset('monster', { anchorX: 0.5, anchorY: 0.5 }); self.health = 1; self.speed = 2; self.damage = 20; self.update = function () { if (player) { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.speed = 8; self.directionX = 1; self.directionY = 0; self.updateDirection = function (dx, dy) { var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.directionX = dx / distance; self.directionY = dy / distance; playerGraphics.rotation = Math.atan2(dy, dx); } }; return self; }); var StrongMonster = Container.expand(function () { var self = Container.call(this); var monsterGraphics = self.attachAsset('strongMonster', { anchorX: 0.5, anchorY: 0.5 }); self.health = 2; // Takes 2 hits to kill self.speed = 2; self.damage = 20; self.update = function () { if (player) { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ var player; var bullets = []; var monsters = []; var dragNode = null; var arena; var healthBar; var lastMonsterSpawn = 0; var monsterSpawnRate = 60; // Spawn monsters twice as fast var waveNumber = 1; var monstersPerWave = 6; // Start with more monsters per wave var monstersSpawned = 0; var monstersKilled = 0; var lastAutoShot = 0; var autoShootInterval = 120; // 2 seconds at 60fps var finalBoss = null; var isFinalBossActive = false; var bossHealthBar = null; // Create arena arena = game.addChild(LK.getAsset('arena', { anchorX: 0.5, anchorY: 0.5 })); arena.x = 2048 / 2; arena.y = 2732 / 2; // Create player player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 / 2; // Create health bar healthBar = new Text2('Health: 100', { size: 60, fill: 0xFFFFFF }); healthBar.anchor.set(0, 0); LK.gui.topLeft.addChild(healthBar); healthBar.x = 120; healthBar.y = 20; // Create score display var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Create wave display var waveText = new Text2('Wave: 1', { size: 50, fill: 0xFFFFFF }); waveText.anchor.set(1, 0); LK.gui.topRight.addChild(waveText); waveText.x = -20; waveText.y = 20; // Create boss health bar (initially hidden) bossHealthBar = new Text2('Boss Health: 20/20', { size: 50, fill: 0xff0000 }); bossHealthBar.anchor.set(0.5, 0); LK.gui.bottom.addChild(bossHealthBar); bossHealthBar.y = -100; bossHealthBar.visible = false; function shootBullet() { // Find nearest monster var nearestMonster = null; var nearestDistance = Infinity; for (var i = 0; i < monsters.length; i++) { var monster = monsters[i]; var dx = monster.x - player.x; var dy = monster.y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestMonster = monster; } } // Only shoot if there's a monster to target if (nearestMonster) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; // Calculate direction to nearest monster var dx = nearestMonster.x - player.x; var dy = nearestMonster.y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); bullet.directionX = dx / distance; bullet.directionY = dy / distance; bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } } function spawnMonster() { var monster; // 1/5 chance (20%) to spawn a strong monster if (Math.random() < 0.2) { monster = new StrongMonster(); } else { monster = new Monster(); } var angle = Math.random() * Math.PI * 2; var spawnRadius = 900; monster.x = 2048 / 2 + Math.cos(angle) * spawnRadius; monster.y = 2732 / 2 + Math.sin(angle) * spawnRadius; monsters.push(monster); game.addChild(monster); monstersSpawned++; } function spawnFinalBoss() { finalBoss = new FinalBoss(); finalBoss.x = 2048 / 2; finalBoss.y = 2732 / 2 - 300; game.addChild(finalBoss); isFinalBossActive = true; bossHealthBar.visible = true; LK.effects.flashScreen(0xff0000, 2000); } function checkCollisions() { // Bullet vs Monster collisions for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; var bulletHit = false; var monstersHit = 0; for (var j = monsters.length - 1; j >= 0; j--) { var monster = monsters[j]; if (bullet.intersects(monster)) { monster.health--; monstersHit++; if (monster.health <= 0) { LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); // Flash monster position before destroying LK.effects.flashObject(monster, 0xffff00, 200); monster.destroy(); monsters.splice(j, 1); monstersKilled++; LK.getSound('hit').play(); } bulletHit = true; break; } } // Check bullet vs final boss collision if (finalBoss && bullet.intersects(finalBoss)) { finalBoss.takeDamage(1); bossHealthBar.setText('Boss Health: ' + finalBoss.health + '/' + finalBoss.maxHealth); if (finalBoss.health <= 0) { LK.setScore(LK.getScore() + 1000); scoreText.setText('Score: ' + LK.getScore()); LK.effects.flashObject(finalBoss, 0xffff00, 1000); finalBoss.destroy(); finalBoss = null; isFinalBossActive = false; bossHealthBar.visible = false; LK.effects.flashScreen(0x00ff00, 2000); LK.showYouWin(); return; } LK.getSound('hit').play(); bulletHit = true; } if (bulletHit) { bullet.destroy(); bullets.splice(i, 1); continue; } // Remove bullets that are off screen if (bullet.x < -100 || bullet.x > 2148 || bullet.y < -100 || bullet.y > 2832) { bullet.destroy(); bullets.splice(i, 1); } } // Monster vs Player collisions for (var k = monsters.length - 1; k >= 0; k--) { var monster = monsters[k]; if (player.intersects(monster)) { player.health -= monster.damage; healthBar.setText('Health: ' + Math.max(0, player.health)); if (player.health <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Flash player red LK.effects.flashObject(player, 0xff0000, 500); LK.getSound('playerHit').play(); // Remove monster after hit monster.destroy(); monsters.splice(k, 1); monstersKilled++; } } // Final Boss vs Player collision if (finalBoss && player.intersects(finalBoss)) { player.health -= finalBoss.damage; healthBar.setText('Health: ' + Math.max(0, player.health)); if (player.health <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } LK.effects.flashObject(player, 0xff0000, 500); LK.getSound('playerHit').play(); } } function updateWave() { if (monstersKilled >= monstersPerWave && monsters.length === 0) { if (waveNumber >= 5 && !isFinalBossActive) { // Spawn final boss after wave 5 spawnFinalBoss(); waveText.setText('FINAL BOSS!'); return; } if (waveNumber < 5) { waveNumber++; waveText.setText('Wave: ' + waveNumber); // Increase difficulty monstersPerWave += 4; // Add more monsters per wave monsterSpawnRate = Math.max(30, monsterSpawnRate - 5); // Spawn even faster // Reset counters monstersSpawned = 0; monstersKilled = 0; } } } function handleMove(x, y, obj) { if (dragNode) { // Keep player within arena bounds var centerX = 2048 / 2; var centerY = 2732 / 2; var maxRadius = 750; var dx = x - centerX; var dy = y - centerY; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > maxRadius) { dx = dx / distance * maxRadius; dy = dy / distance * maxRadius; } var newX = centerX + dx; var newY = centerY + dy; // Update player direction based on movement var moveDx = newX - dragNode.x; var moveDy = newY - dragNode.y; if (Math.abs(moveDx) > 1 || Math.abs(moveDy) > 1) { dragNode.updateDirection(moveDx, moveDy); } dragNode.x = newX; dragNode.y = newY; } } game.move = handleMove; game.down = function (x, y, obj) { dragNode = player; handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { // Automatic shooting every 3 seconds if (LK.ticks - lastAutoShot > autoShootInterval) { shootBullet(); lastAutoShot = LK.ticks; } // Spawn monsters (only if not in final boss phase) if (!isFinalBossActive && monstersSpawned < monstersPerWave && LK.ticks - lastMonsterSpawn > monsterSpawnRate) { spawnMonster(); lastMonsterSpawn = LK.ticks; } // Check collisions checkCollisions(); // Update wave (only if not in final boss phase) if (!isFinalBossActive) { updateWave(); } // Update health bar color based on health var healthPercent = player.health / player.maxHealth; if (healthPercent > 0.6) { healthBar.tint = 0x00ff00; } else if (healthPercent > 0.3) { healthBar.tint = 0xffff00; } else { healthBar.tint = 0xff0000; } };
===================================================================
--- original.js
+++ change.js
@@ -20,8 +20,92 @@
self.y += self.directionY * self.speed;
};
return self;
});
+var FinalBoss = Container.expand(function () {
+ var self = Container.call(this);
+ var bossGraphics = self.attachAsset('strongMonster', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 2,
+ scaleY: 2
+ });
+ self.health = 20; // Very strong boss
+ self.maxHealth = 20;
+ self.speed = 1;
+ self.damage = 30;
+ self.phase = 1; // Boss has 3 phases
+ self.lastAttack = 0;
+ self.attackCooldown = 180; // 3 seconds between attacks
+ self.specialAttackCounter = 0;
+ self.update = function () {
+ if (player) {
+ var dx = player.x - self.x;
+ var dy = player.y - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 200) {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ }
+ // Special attack pattern
+ if (LK.ticks - self.lastAttack > self.attackCooldown) {
+ self.specialAttack();
+ self.lastAttack = LK.ticks;
+ }
+ }
+ };
+ self.specialAttack = function () {
+ self.specialAttackCounter++;
+ // Every 4th attack is Russian roulette
+ if (self.specialAttackCounter % 4 === 0) {
+ self.russianRoulette();
+ } else {
+ self.normalAttack();
+ }
+ };
+ self.normalAttack = function () {
+ // Spawn multiple bullets in a circle pattern
+ for (var i = 0; i < 8; i++) {
+ var angle = i / 8 * Math.PI * 2;
+ var bullet = new Bullet();
+ bullet.x = self.x;
+ bullet.y = self.y;
+ bullet.directionX = Math.cos(angle);
+ bullet.directionY = Math.sin(angle);
+ bullet.speed = 8;
+ bullets.push(bullet);
+ game.addChild(bullet);
+ }
+ };
+ self.russianRoulette = function () {
+ // 4 chambers: 1 empty (safe), 3 with bullets (damage)
+ var chamber = Math.floor(Math.random() * 4);
+ if (chamber === 0) {
+ // Safe chamber - boss takes damage
+ self.health -= 3;
+ LK.effects.flashObject(self, 0x00ff00, 1000);
+ } else {
+ // Bullet chamber - player takes damage
+ player.health -= 40;
+ LK.effects.flashObject(player, 0xff0000, 1000);
+ LK.getSound('playerHit').play();
+ }
+ };
+ self.takeDamage = function (damage) {
+ self.health -= damage;
+ // Change phase based on health
+ if (self.health <= 15 && self.phase === 1) {
+ self.phase = 2;
+ self.speed = 1.5;
+ self.attackCooldown = 150;
+ } else if (self.health <= 10 && self.phase === 2) {
+ self.phase = 3;
+ self.speed = 2;
+ self.attackCooldown = 120;
+ }
+ };
+ return self;
+});
var Monster = Container.expand(function () {
var self = Container.call(this);
var monsterGraphics = self.attachAsset('monster', {
anchorX: 0.5,
@@ -110,8 +194,11 @@
var monstersSpawned = 0;
var monstersKilled = 0;
var lastAutoShot = 0;
var autoShootInterval = 120; // 2 seconds at 60fps
+var finalBoss = null;
+var isFinalBossActive = false;
+var bossHealthBar = null;
// Create arena
arena = game.addChild(LK.getAsset('arena', {
anchorX: 0.5,
anchorY: 0.5
@@ -146,8 +233,17 @@
waveText.anchor.set(1, 0);
LK.gui.topRight.addChild(waveText);
waveText.x = -20;
waveText.y = 20;
+// Create boss health bar (initially hidden)
+bossHealthBar = new Text2('Boss Health: 20/20', {
+ size: 50,
+ fill: 0xff0000
+});
+bossHealthBar.anchor.set(0.5, 0);
+LK.gui.bottom.addChild(bossHealthBar);
+bossHealthBar.y = -100;
+bossHealthBar.visible = false;
function shootBullet() {
// Find nearest monster
var nearestMonster = null;
var nearestDistance = Infinity;
@@ -192,8 +288,17 @@
monsters.push(monster);
game.addChild(monster);
monstersSpawned++;
}
+function spawnFinalBoss() {
+ finalBoss = new FinalBoss();
+ finalBoss.x = 2048 / 2;
+ finalBoss.y = 2732 / 2 - 300;
+ game.addChild(finalBoss);
+ isFinalBossActive = true;
+ bossHealthBar.visible = true;
+ LK.effects.flashScreen(0xff0000, 2000);
+}
function checkCollisions() {
// Bullet vs Monster collisions
for (var i = bullets.length - 1; i >= 0; i--) {
var bullet = bullets[i];
@@ -217,8 +322,27 @@
bulletHit = true;
break;
}
}
+ // Check bullet vs final boss collision
+ if (finalBoss && bullet.intersects(finalBoss)) {
+ finalBoss.takeDamage(1);
+ bossHealthBar.setText('Boss Health: ' + finalBoss.health + '/' + finalBoss.maxHealth);
+ if (finalBoss.health <= 0) {
+ LK.setScore(LK.getScore() + 1000);
+ scoreText.setText('Score: ' + LK.getScore());
+ LK.effects.flashObject(finalBoss, 0xffff00, 1000);
+ finalBoss.destroy();
+ finalBoss = null;
+ isFinalBossActive = false;
+ bossHealthBar.visible = false;
+ LK.effects.flashScreen(0x00ff00, 2000);
+ LK.showYouWin();
+ return;
+ }
+ LK.getSound('hit').play();
+ bulletHit = true;
+ }
if (bulletHit) {
bullet.destroy();
bullets.splice(i, 1);
continue;
@@ -248,24 +372,39 @@
monsters.splice(k, 1);
monstersKilled++;
}
}
+ // Final Boss vs Player collision
+ if (finalBoss && player.intersects(finalBoss)) {
+ player.health -= finalBoss.damage;
+ healthBar.setText('Health: ' + Math.max(0, player.health));
+ if (player.health <= 0) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ LK.effects.flashObject(player, 0xff0000, 500);
+ LK.getSound('playerHit').play();
+ }
}
function updateWave() {
if (monstersKilled >= monstersPerWave && monsters.length === 0) {
- if (waveNumber >= 5) {
- LK.effects.flashScreen(0x00ff00, 1000);
- LK.showYouWin();
+ if (waveNumber >= 5 && !isFinalBossActive) {
+ // Spawn final boss after wave 5
+ spawnFinalBoss();
+ waveText.setText('FINAL BOSS!');
return;
}
- waveNumber++;
- waveText.setText('Wave: ' + waveNumber);
- // Increase difficulty
- monstersPerWave += 4; // Add more monsters per wave
- monsterSpawnRate = Math.max(30, monsterSpawnRate - 5); // Spawn even faster
- // Reset counters
- monstersSpawned = 0;
- monstersKilled = 0;
+ if (waveNumber < 5) {
+ waveNumber++;
+ waveText.setText('Wave: ' + waveNumber);
+ // Increase difficulty
+ monstersPerWave += 4; // Add more monsters per wave
+ monsterSpawnRate = Math.max(30, monsterSpawnRate - 5); // Spawn even faster
+ // Reset counters
+ monstersSpawned = 0;
+ monstersKilled = 0;
+ }
}
}
function handleMove(x, y, obj) {
if (dragNode) {
@@ -305,17 +444,19 @@
if (LK.ticks - lastAutoShot > autoShootInterval) {
shootBullet();
lastAutoShot = LK.ticks;
}
- // Spawn monsters
- if (monstersSpawned < monstersPerWave && LK.ticks - lastMonsterSpawn > monsterSpawnRate) {
+ // Spawn monsters (only if not in final boss phase)
+ if (!isFinalBossActive && monstersSpawned < monstersPerWave && LK.ticks - lastMonsterSpawn > monsterSpawnRate) {
spawnMonster();
lastMonsterSpawn = LK.ticks;
}
// Check collisions
checkCollisions();
- // Update wave
- updateWave();
+ // Update wave (only if not in final boss phase)
+ if (!isFinalBossActive) {
+ updateWave();
+ }
// Update health bar color based on health
var healthPercent = player.health / player.maxHealth;
if (healthPercent > 0.6) {
healthBar.tint = 0x00ff00;