User prompt
счетчик слева
User prompt
счетчик жизней в виде красного сердца
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'set')' in or related to this line: 'livesTxt.anchor.set(1, 0); // Sets anchor to the right of the top edge of the text.' Line Number: 178
User prompt
счетчик жизней в виде сердца
User prompt
враги стоят на месте 30 секунд когда игрок соберет золотую какашку
User prompt
враги стоят на месте 200 секунд когда игрок соберет золотую какашку
User prompt
враги стоят на месте 30 секунд когда игрок соберет золотую какашку
User prompt
удали врагов на 30 секунд когда игрок соберет золотую какашку
User prompt
останови врагов на 100 секунд когда игрок соберет золотую какашку
User prompt
останови врагов на 30 секунд когда игрок соберет золотую какашку
User prompt
останови врагов на 10 секунд когда игрок соберет золотую какашку
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -88,18 +88,15 @@
}
}
};
});
-var GoldenPoop = Container.expand(function () {
+// Heart class
+var Heart = Container.expand(function () {
var self = Container.call(this);
- var goldenPoopGraphics = self.attachAsset('goldenPoop', {
+ var heartGraphics = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
- self.reposition = function () {
- self.x = Math.random() * 2048;
- self.y = Math.random() * 2732;
- };
});
// Life class
var Life = Container.expand(function () {
var self = Container.call(this);
@@ -165,12 +162,9 @@
});
scoreTxt.anchor.set(0.5, 0); // Sets anchor to the center of the top edge of the text.
LK.gui.top.addChild(scoreTxt); // Add the score text to the GUI overlay at the top of the screen.
// Initialize and display player lives
-var livesTxt = new Text2('10', {
- size: 150,
- fill: "#FF0000" // Red color
-});
+var livesTxt = new Heart();
livesTxt.anchor.set(1, 0); // Sets anchor to the right of the top edge of the text.
LK.gui.topRight.addChild(livesTxt); // Add the lives text to the GUI overlay at the top right of the screen.
var enemyScore = 0;
// Initialize variables
@@ -217,15 +211,8 @@
poop.y = 2732 / 2;
spirals.push(poop);
game.addChild(poop);
}
- if (Math.random() < 0.1) {
- // 10% chance to spawn golden poop
- var goldenPoop = new GoldenPoop();
- goldenPoop.reposition();
- spirals.push(goldenPoop);
- game.addChild(goldenPoop);
- }
}
// Add life instances to the game
if (LK.ticks % 600 === 0) {
// every 10 seconds
@@ -274,27 +261,8 @@
livesTxt.setText('Lives: ' + playerLives); // Update the displayed lives
// Make the player's car blink red when it takes damage
LK.effects.flashObject(car, 0xff0000, 1000);
}
- } else if (spirals[i] instanceof GoldenPoop) {
- if (car.intersects(spirals[i])) {
- spirals[i].destroy();
- spirals.splice(i, 1);
- playerScore += 1000; // Increase player score by 1000 when golden poop is collected
- LK.setScore(playerScore); // Update the displayed score
- scoreTxt.setText(LK.getScore()); // Update the score text
- // Stop enemies for 30 seconds
- enemies.forEach(function (enemy) {
- enemy.speedX = 0;
- enemy.speedY = 0;
- });
- LK.setTimeout(function () {
- enemies.forEach(function (enemy) {
- enemy.speedX = (Math.random() - 0.5) * 10;
- enemy.speedY = (Math.random() - 0.5) * 10;
- });
- }, 30000);
- }
} else if (spirals[i] instanceof Life) {
if (car.intersects(spirals[i])) {
spirals[i].destroy();
spirals.splice(i, 1);
toilet room background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
fly
poop. 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.