User prompt
Победа на 80 балов. На 50 убрать победу
User prompt
Победа на 80 балов
User prompt
Когда набираем 50 балов добавляем новый зеленый бот который ускоряет шары внис при косании
User prompt
В 35 шары ещо быстрее
User prompt
Когда 30 балов шары ещо чуть быстрее
User prompt
Поставить фон музыку 223
User prompt
Выключить фон музыку
User prompt
Хлопок добавить в звук зрыв
User prompt
rubbish звук вставить в зрыв
User prompt
rubbish вставить в зрыв
User prompt
rubbish музыку фон
User prompt
rubbish звуквставить взрыв
User prompt
Враги чуть быстрее
User prompt
4 врога когда балов будет 40
User prompt
Добавить врога
User prompt
Враки разделить от друга
User prompt
Враг красный
User prompt
Циферблат фиолетовый
User prompt
Враг, друг, поевляются внизу фона
User prompt
Враг отнимает 1 бал
User prompt
Убрать Бог левый Бог правый
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'if (godLeft && Math.abs(balloons[i].x - godLeft.x) < 100 && Math.abs(balloons[i].y - godLeft.y) < 100) {' Line Number: 367
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'if (Math.abs(balloons[i].x - godLeft.x) < 100 && Math.abs(balloons[i].y - godLeft.y) < 100) {' Line Number: 367
User prompt
Шары избегают Бог левый Бог правый
User prompt
Расширить фон
/**** * Classes ****/ // Assets will be automatically created and loaded during gameplay // Balloon class var Balloon = Container.expand(function () { var self = Container.call(this); var balloonGraphics = self.attachAsset('balloon', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.update = function () { if (LK.getScore() >= 20) { self.speed = 4; } self.y += self.speed; if (self.y < self.height / 2) { self.y = self.height / 2; } if (self.x < self.width / 2) { self.x = self.width / 2; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; } if (self.y > 2732 - self.height / 2) { self.y = 2732 - self.height / 2; self.speed = 0; LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); if (miniFriend && miniFriend.intersects(self)) { // No score increment when mini friend intersects balloon } } // Check if balloon is close to any explosion and avoid it for (var i = 0; i < explosions.length; i++) { var explosion = explosions[i]; if (Math.abs(self.x - explosion.x) < 100 && Math.abs(self.y - explosion.y) < 100) { self.x += self.x - explosion.x > 0 ? 5 : -5; self.y += self.y - explosion.y > 0 ? 5 : -5; self.y -= 10; // Push balloon upwards if close to explosion } // Push balloon away from expanding explosion if (Math.abs(self.x - explosion.x) < 200 && Math.abs(self.y - explosion.y) < 200) { self.x += self.x - explosion.x > 0 ? 2 : -2; self.y += self.y - explosion.y > 0 ? 2 : -2; } } // Removed unnecessary destruction of balloons when they go off the screen }; self.down = function (x, y, obj) { self.pop(); }; self.pop = function () { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); for (var i = balloons.length - 1; i >= 0; i--) { if (balloons[i].y > 2732 - balloons[i].height / 2) { balloons.splice(i, 1); } } for (var i = balloons.length - 1; i >= 0; i--) { if (balloons[i].y > 2732 - balloons[i].height / 2) { balloons.splice(i, 1); } } // Create explosion effect var explosion = LK.getAsset('explosion', { anchorX: 0.5, anchorY: 0.5, x: self.x, y: self.y }); // Check if balloon is close enough to the explosion if (Math.abs(self.x - explosion.x) < 100 && Math.abs(self.y - explosion.y) < 100) { self.y -= 10; // Push balloon upwards if close to explosion // Create explosion effect var explosion = LK.getAsset('explosion', { anchorX: 0.5, anchorY: 0.5, x: self.x, y: self.y }); game.addChild(explosion); explosions.push(explosion); expandExplosion(explosion); LK.setTimeout(function () { explosion.destroy(); var index = explosions.indexOf(explosion); if (index > -1) { explosions.splice(index, 1); } }, 3000); LK.effects.flashObject(explosion, 0xff0000, 500); // Flash red for 500ms // Push all nearby balloons for (var i = 0; i < balloons.length; i++) { var balloon = balloons[i]; if (Math.abs(balloon.x - explosion.x) < 200 && Math.abs(balloon.y - explosion.y) < 200) { balloon.x += balloon.x - explosion.x > 0 ? 10 : -10; balloon.y += balloon.y - explosion.y > 0 ? 10 : -10; } } } self.destroy(); if (LK.getScore() >= 50 || LK.getScore() < 0) { LK.showGameOver(); } }; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('miniFriend', { anchorX: 0.5, anchorY: 0.5, color: 0xff0000 // Set color to red }); self.lifetime = 15 * 60; // 15 seconds in ticks self.update = function () { self.lifetime--; if (self.lifetime <= 0) { self.destroy(); } // Move towards the nearest balloon if (balloons.length > 0) { var nearestBalloon = balloons[0]; var minDistance = Math.sqrt(Math.pow(self.x - nearestBalloon.x, 2) + Math.pow(self.y - nearestBalloon.y, 2)); for (var i = 1; i < balloons.length; i++) { var distance = Math.sqrt(Math.pow(self.x - balloons[i].x, 2) + Math.pow(self.y - balloons[i].y, 2)); if (distance < minDistance) { nearestBalloon = balloons[i]; minDistance = distance; } } var angle = Math.atan2(nearestBalloon.y - self.y, nearestBalloon.x - self.x); self.x += Math.cos(angle) * 2; self.y += Math.sin(angle) * 2; } for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; self.down = function (x, y, obj) { for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; }); var Enemy2 = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('miniFriend', { anchorX: 0.5, anchorY: 0.5, color: 0xff0000 // Set color to red }); self.lifetime = 10 * 60; // 10 seconds in ticks self.update = function () { self.lifetime--; if (self.lifetime <= 0) { self.destroy(); } // Move towards the nearest balloon if (balloons.length > 0) { var nearestBalloon = balloons[0]; var minDistance = Math.sqrt(Math.pow(self.x - nearestBalloon.x, 2) + Math.pow(self.y - nearestBalloon.y, 2)); for (var i = 1; i < balloons.length; i++) { var distance = Math.sqrt(Math.pow(self.x - balloons[i].x, 2) + Math.pow(self.y - balloons[i].y, 2)); if (distance < minDistance) { nearestBalloon = balloons[i]; minDistance = distance; } } var angle = Math.atan2(nearestBalloon.y - self.y, nearestBalloon.x - self.x); self.x += Math.cos(angle) * 3; // Faster speed self.y += Math.sin(angle) * 3; // Faster speed } for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; self.down = function (x, y, obj) { for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; }); var MiniFriend = Container.expand(function () { var self = Container.call(this); var miniFriendGraphics = self.attachAsset('miniFriend', { anchorX: 0.5, anchorY: 0.5 }); self.lifetime = 15 * 60; // 15 seconds in ticks self.update = function () { self.lifetime--; if (self.lifetime <= 0) { self.destroy(); } // Move towards the nearest balloon if (balloons.length > 0) { var nearestBalloon = balloons[0]; var minDistance = Math.sqrt(Math.pow(self.x - nearestBalloon.x, 2) + Math.pow(self.y - nearestBalloon.y, 2)); for (var i = 1; i < balloons.length; i++) { var distance = Math.sqrt(Math.pow(self.x - balloons[i].x, 2) + Math.pow(self.y - balloons[i].y, 2)); if (distance < minDistance) { nearestBalloon = balloons[i]; minDistance = distance; } } var angle = Math.atan2(nearestBalloon.y - self.y, nearestBalloon.x - self.x); self.x += Math.cos(angle) * 2; self.y += Math.sin(angle) * 2; } for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); self.destroy(); // Destroy mini friend after popping a balloon break; // Exit loop after popping one balloon } } }; self.down = function (x, y, obj) { for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); self.destroy(); // Destroy mini friend after popping a balloon break; // Exit loop after popping one balloon } } }; }); var NewEnemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('miniFriend', { anchorX: 0.5, anchorY: 0.5, color: 0xff0000 // Set color to red }); self.lifetime = 20 * 60; // 20 seconds in ticks self.update = function () { self.lifetime--; if (self.lifetime <= 0) { self.destroy(); } // Move towards the nearest balloon if (balloons.length > 0) { var nearestBalloon = balloons[0]; var minDistance = Math.sqrt(Math.pow(self.x - nearestBalloon.x, 2) + Math.pow(self.y - nearestBalloon.y, 2)); for (var i = 1; i < balloons.length; i++) { var distance = Math.sqrt(Math.pow(self.x - balloons[i].x, 2) + Math.pow(self.y - balloons[i].y, 2)); if (distance < minDistance) { nearestBalloon = balloons[i]; minDistance = distance; } } var angle = Math.atan2(nearestBalloon.y - self.y, nearestBalloon.x - self.x); self.x += Math.cos(angle) * 2; self.y += Math.sin(angle) * 2; } for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; self.down = function (x, y, obj) { for (var i = balloons.length - 1; i >= 0; i--) { if (self.intersects(balloons[i])) { balloons[i].pop(); LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); self.destroy(); // Destroy enemy after popping a balloon break; // Exit loop after popping one balloon } } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x66e4af7512d26d43857c57ab // Init game with landscape background }); /**** * Game Code ****/ var landscape = LK.getAsset('landscape', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, scaleX: 2048 / 2048, scaleY: 2732 / 2048, width: 2048, height: 2732 }); game.addChild(landscape); landscape.width = 2048; landscape.height = 2732; var scoreTxt = new Text2('0', { size: 150, fill: "#800080" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var shield = 3; // Initialize shield with 3 lives var balloons = []; var miniFriend = null; var enemySpawned = false; var miniFriendSpawned = false; var enemy2Spawned = false; var explosions = []; // Initialize explosions array to keep track of explosions // Function to expand explosion effect function expandExplosion(explosion) { var radius = 0; var interval = LK.setInterval(function () { radius += 20; // Increase radius quickly explosion.width = radius; explosion.height = radius; if (radius >= 200) { LK.clearInterval(interval); explosion.destroy(); var index = explosions.indexOf(explosion); if (index > -1) { explosions.splice(index, 1); } } }, 50); // Reduce interval time for faster expansion } var spawnBalloon = function spawnBalloon() { var newBalloon = new Balloon(); newBalloon.x = Math.random() * 2048; newBalloon.y = -100; balloons.push(newBalloon); game.addChild(newBalloon); }; game.update = function () { for (var i = balloons.length - 1; i >= 0; i--) { if (LK.getScore() >= 20) { balloons[i].speed = 4; } // Removed unnecessary destruction of balloons when they go off the screen for (var i = balloons.length - 1; i >= 0; i--) { if (balloons[i].y > 2732 - balloons[i].height / 2) { balloons.splice(i, 1); } } for (var i = balloons.length - 1; i >= 0; i--) { if (balloons[i].y > 2732 - balloons[i].height / 2) { balloons.splice(i, 1); } } } if (LK.getScore() < 0) { LK.showGameOver(); } if (LK.ticks % 60 == 0) { spawnBalloon(); } if (LK.getScore() >= 10 && !miniFriendSpawned) { miniFriendSpawned = true; miniFriend = new MiniFriend(); miniFriend.x = Math.random() * 2048; miniFriend.y = 2732; // Spawn at the bottom of the screen game.addChild(miniFriend); LK.setTimeout(function () { miniFriend.destroy(); miniFriendSpawned = false; }, 20000); // 20 seconds } if (LK.getScore() >= 30 && !enemySpawned) { enemySpawned = true; var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 2732; // Spawn at the bottom of the screen game.addChild(enemy); LK.setTimeout(function () { enemy.destroy(); enemySpawned = false; }, 20000); // 20 seconds } if (LK.getScore() >= 40 && !enemy2Spawned) { enemy2Spawned = true; var enemy2 = new Enemy2(); enemy2.x = Math.random() * 2048; enemy2.y = 2732; // Spawn at the bottom of the screen game.addChild(enemy2); LK.setTimeout(function () { enemy2.destroy(); enemy2Spawned = false; }, 20000); // 20 seconds } if (LK.getScore() >= 50 && !newEnemySpawned) { newEnemySpawned = true; var newEnemy = new NewEnemy(); newEnemy.x = Math.random() * 2048; newEnemy.y = 2732; // Spawn at the bottom of the screen game.addChild(newEnemy); LK.setTimeout(function () { newEnemy.destroy(); newEnemySpawned = false; }, 20000); // 20 seconds } };
===================================================================
--- original.js
+++ change.js
@@ -253,8 +253,58 @@
}
}
};
});
+var NewEnemy = Container.expand(function () {
+ var self = Container.call(this);
+ var enemyGraphics = self.attachAsset('miniFriend', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ color: 0xff0000 // Set color to red
+ });
+ self.lifetime = 20 * 60; // 20 seconds in ticks
+ self.update = function () {
+ self.lifetime--;
+ if (self.lifetime <= 0) {
+ self.destroy();
+ }
+ // Move towards the nearest balloon
+ if (balloons.length > 0) {
+ var nearestBalloon = balloons[0];
+ var minDistance = Math.sqrt(Math.pow(self.x - nearestBalloon.x, 2) + Math.pow(self.y - nearestBalloon.y, 2));
+ for (var i = 1; i < balloons.length; i++) {
+ var distance = Math.sqrt(Math.pow(self.x - balloons[i].x, 2) + Math.pow(self.y - balloons[i].y, 2));
+ if (distance < minDistance) {
+ nearestBalloon = balloons[i];
+ minDistance = distance;
+ }
+ }
+ var angle = Math.atan2(nearestBalloon.y - self.y, nearestBalloon.x - self.x);
+ self.x += Math.cos(angle) * 2;
+ self.y += Math.sin(angle) * 2;
+ }
+ for (var i = balloons.length - 1; i >= 0; i--) {
+ if (self.intersects(balloons[i])) {
+ balloons[i].pop();
+ LK.setScore(LK.getScore() - 1);
+ scoreTxt.setText(LK.getScore());
+ self.destroy(); // Destroy enemy after popping a balloon
+ break; // Exit loop after popping one balloon
+ }
+ }
+ };
+ self.down = function (x, y, obj) {
+ for (var i = balloons.length - 1; i >= 0; i--) {
+ if (self.intersects(balloons[i])) {
+ balloons[i].pop();
+ LK.setScore(LK.getScore() - 1);
+ scoreTxt.setText(LK.getScore());
+ self.destroy(); // Destroy enemy after popping a balloon
+ break; // Exit loop after popping one balloon
+ }
+ }
+ };
+});
/****
* Initialize Game
****/
@@ -370,5 +420,16 @@
enemy2.destroy();
enemy2Spawned = false;
}, 20000); // 20 seconds
}
+ if (LK.getScore() >= 50 && !newEnemySpawned) {
+ newEnemySpawned = true;
+ var newEnemy = new NewEnemy();
+ newEnemy.x = Math.random() * 2048;
+ newEnemy.y = 2732; // Spawn at the bottom of the screen
+ game.addChild(newEnemy);
+ LK.setTimeout(function () {
+ newEnemy.destroy();
+ newEnemySpawned = false;
+ }, 20000); // 20 seconds
+ }
};
\ No newline at end of file
Шарик воздушный на с галстуком Ярко жолтый цвет и синий галстук. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Пчела. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Круглая кнопка прозрачная внутри нота. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Поле, посередине Луна ночная версия. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.