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
/****
* 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 = 10;
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 = 15;
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
// 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();
}
}
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();
}
// Spawn monsters randomly around arena in a circle
var angle = Math.random() * Math.PI * 2;
var radius = 900 + Math.random() * 100;
var centerX = 2048 / 2;
var centerY = 2732 / 2;
monster.x = centerX + Math.cos(angle) * radius;
monster.y = centerY + Math.sin(angle) * radius;
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();
}
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)) {
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) {
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;
};
// Play Babapiro music in the background
LK.playMusic('Babapiro');
game.update = function () {
// 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
@@ -297,8 +297,10 @@
};
game.up = function (x, y, obj) {
dragNode = null;
};
+// Play Babapiro music in the background
+LK.playMusic('Babapiro');
game.update = function () {
// Automatic shooting every 3 seconds
if (LK.ticks - lastAutoShot > autoShootInterval) {
shootBullet();