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 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 ultimateActive = false; var ultimateEndTime = 0; var shotsFired = 0; var ultimateReady = false; var playerInvulnerable = false; // 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; 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(); // Track shots fired for ultimate ability shotsFired++; if (shotsFired >= 8) { ultimateReady = true; } } } function shootUltimateDirectional() { // Find nearest monster for targeting 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(); // Replace bullet graphics with bullet2 asset bullet.removeChild(bullet.children[0]); var bullet2Graphics = bullet.attachAsset('bullet2', { anchorX: 0.5, anchorY: 0.5 }); 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; // Mark as ultimate bullet for piercing bullet.isUltimate = true; 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 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(); } // Ultimate bullets can pierce through 1 monster, regular bullets stop after first hit if (!bullet.isUltimate) { bulletHit = true; break; } else if (monstersHit >= 1) { bulletHit = true; break; } } } 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) && !playerInvulnerable) { 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++; } } } function updateWave() { if (monstersKilled >= monstersPerWave && monsters.length === 0) { if (waveNumber >= 5) { LK.effects.flashScreen(0x00ff00, 1000); LK.showYouWin(); 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; } } 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); // Activate ultimate ability only when ready if (ultimateReady && !ultimateActive) { ultimateActive = true; ultimateEndTime = LK.ticks + 180; // 3 seconds at 60fps ultimateReady = false; shotsFired = 0; // Reset shot counter when ultimate is activated // Activate invulnerability for 2 seconds playerInvulnerable = true; // Make player semi-transparent to show invulnerability tween(player, { alpha: 0.5 }, { duration: 0 }); // End invulnerability after 2 seconds tween(player, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { playerInvulnerable = false; } }); // Change player to player2 asset during ultimate var currentRotation = player.children[0] ? player.children[0].rotation : 0; player.removeChild(player.children[0]); var player2Graphics = player.attachAsset('player2', { anchorX: 0.5, anchorY: 0.5 }); player2Graphics.rotation = currentRotation; // Shoot single piercing bullet when ultimate is activated shootUltimateDirectional(); } }; game.up = function (x, y, obj) { dragNode = null; }; game.update = function () { // Manage ultimate ability if (ultimateActive && LK.ticks >= ultimateEndTime) { ultimateActive = false; // Reset player appearance to original asset when ultimate ends var currentRotation = player.children[0] ? player.children[0].rotation : 0; player.removeChild(player.children[0]); var playerGraphics = player.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); playerGraphics.rotation = currentRotation; } // Automatic shooting every 3 seconds if (LK.ticks - lastAutoShot > autoShootInterval) { shootBullet(); lastAutoShot = LK.ticks; } // Spawn monsters if (monstersSpawned < monstersPerWave && LK.ticks - lastMonsterSpawn > monsterSpawnRate) { spawnMonster(); lastMonsterSpawn = LK.ticks; } // Check collisions checkCollisions(); // Update wave 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
@@ -114,8 +114,9 @@
var ultimateActive = false;
var ultimateEndTime = 0;
var shotsFired = 0;
var ultimateReady = false;
+var playerInvulnerable = false;
// Create arena
arena = game.addChild(LK.getAsset('arena', {
anchorX: 0.5,
anchorY: 0.5
@@ -186,63 +187,44 @@
}
}
}
function shootUltimateDirectional() {
- // Shoot bullets in 8 directions around the player
- var directions = [{
- x: 1,
- y: 0
- },
- // Right
- {
- x: -1,
- y: 0
- },
- // Left
- {
- x: 0,
- y: 1
- },
- // Down
- {
- x: 0,
- y: -1
- },
- // Up
- {
- x: 1,
- y: 1
- },
- // Down-Right
- {
- x: -1,
- y: 1
- },
- // Down-Left
- {
- x: 1,
- y: -1
- },
- // Up-Right
- {
- x: -1,
- y: -1
- } // Up-Left
- ];
- for (var i = 0; i < directions.length; i++) {
+ // Find nearest monster for targeting
+ 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();
+ // Replace bullet graphics with bullet2 asset
+ bullet.removeChild(bullet.children[0]);
+ var bullet2Graphics = bullet.attachAsset('bullet2', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
bullet.x = player.x;
bullet.y = player.y;
- // Normalize direction
- var dx = directions[i].x;
- var dy = directions[i].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;
+ // Mark as ultimate bullet for piercing
+ bullet.isUltimate = true;
bullets.push(bullet);
game.addChild(bullet);
+ LK.getSound('shoot').play();
}
- LK.getSound('shoot').play();
}
function spawnMonster() {
var monster;
// 1/5 chance (20%) to spawn a strong monster
@@ -279,10 +261,10 @@
monsters.splice(j, 1);
monstersKilled++;
LK.getSound('hit').play();
}
- // During ultimate, bullets can hit up to 1 monster (pierce through once)
- if (!ultimateActive) {
+ // Ultimate bullets can pierce through 1 monster, regular bullets stop after first hit
+ if (!bullet.isUltimate) {
bulletHit = true;
break;
} else if (monstersHit >= 1) {
bulletHit = true;
@@ -303,9 +285,9 @@
}
// Monster vs Player collisions
for (var k = monsters.length - 1; k >= 0; k--) {
var monster = monsters[k];
- if (player.intersects(monster)) {
+ if (player.intersects(monster) && !playerInvulnerable) {
player.health -= monster.damage;
healthBar.setText('Health: ' + Math.max(0, player.health));
if (player.health <= 0) {
LK.effects.flashScreen(0xff0000, 1000);
@@ -373,17 +355,34 @@
ultimateActive = true;
ultimateEndTime = LK.ticks + 180; // 3 seconds at 60fps
ultimateReady = false;
shotsFired = 0; // Reset shot counter when ultimate is activated
+ // Activate invulnerability for 2 seconds
+ playerInvulnerable = true;
+ // Make player semi-transparent to show invulnerability
+ tween(player, {
+ alpha: 0.5
+ }, {
+ duration: 0
+ });
+ // End invulnerability after 2 seconds
+ tween(player, {
+ alpha: 1
+ }, {
+ duration: 2000,
+ onFinish: function onFinish() {
+ playerInvulnerable = false;
+ }
+ });
// Change player to player2 asset during ultimate
var currentRotation = player.children[0] ? player.children[0].rotation : 0;
player.removeChild(player.children[0]);
var player2Graphics = player.attachAsset('player2', {
anchorX: 0.5,
anchorY: 0.5
});
player2Graphics.rotation = currentRotation;
- // Shoot bullets in all directions when ultimate is activated
+ // Shoot single piercing bullet when ultimate is activated
shootUltimateDirectional();
}
};
game.up = function (x, y, obj) {