User prompt
золотая какашка заставляет врагов остановиться на месте на 10 секунд
Code edit (5 edits merged)
Please save this source code
User prompt
добавь золотую какашку которая отключает врагов на 10 секунд и приносит 1000 очков
User prompt
добавь зеленую какашку которая убивает врагов на 10 секунд если они ее соберут
User prompt
игрок мигает красным если меньше жизней
User prompt
игрок мигает красным при уроне
User prompt
жизни мигают перед исчезновением
User prompt
жизни исчезают через три секунды
User prompt
жизни пропадают через 2 секунды после появления
User prompt
Please fix the bug: 'TypeError: spirals[i].update is not a function' in or related to this line: 'spirals[i].update();' Line Number: 231
User prompt
добавь случайное появление жизней
User prompt
отнимай жизни у игрока если враги собрали какашки
User prompt
почини счетчик жизней
User prompt
враги не отнимают очки но отнимают жизни
User prompt
у игрока 10 жизней отнимай дну жизнь если враг украл какашку
Code edit (2 edits merged)
Please save this source code
User prompt
отнимай очки у игрока если он не собрал какашку
Code edit (1 edits merged)
Please save this source code
User prompt
игра начинается со 100 очков
User prompt
если очки станут равны нулю игра закончится
User prompt
отнимай 100 очков если враги украли какашку
User prompt
показывай очки игрока сверху синим цветом
User prompt
за каждую какашку игрок получает 100 очков
User prompt
удали счетчики
User prompt
почини счетчики, они не работают
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Car class
var Car = Container.expand(function () {
var self = Container.call(this);
var carGraphics = self.attachAsset('car', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.direction = 0; // 0: straight, 1: left, 2: right
self.update = function () {
if (self.direction === 1) {
self.rotation -= 0.05;
} else if (self.direction === 2) {
self.rotation += 0.05;
}
var newX = self.x + self.speed * Math.cos(self.rotation);
var newY = self.y + self.speed * Math.sin(self.rotation);
// Check if the new position is within the game area
if (newX >= 0 && newX <= 2048 && newY >= 0 && newY <= 2732) {
self.x = newX;
self.y = newY;
}
};
self.turnLeft = function () {
self.direction = 1;
};
self.turnRight = function () {
self.direction = 2;
};
self.straighten = function () {
self.direction = 0;
};
});
// Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.update = function () {
// Randomly change direction
if (Math.random() < 0.01) {
self.speedX = (Math.random() - 0.5) * 10;
self.speedY = (Math.random() - 0.5) * 10;
}
// Move in a random direction
self.x += self.speedX;
self.y += self.speedY;
// Keep within game area and bounce off the walls
if (self.x < 0) {
self.x = 0;
self.speedX = -self.speedX;
}
if (self.x > 2048) {
self.x = 2048;
self.speedX = -self.speedX;
}
if (self.y < 0) {
self.y = 0;
self.speedY = -self.speedY;
}
if (self.y > 2732) {
self.y = 2732;
self.speedY = -self.speedY;
}
// Check if the enemy intersects with any poop
for (var i = 0; i < spirals.length; i++) {
if (spirals[i] instanceof Poop && self.intersects(spirals[i])) {
// Remove the poop from the game
spirals[i].destroy();
spirals.splice(i, 1);
// Increase the speed of the enemy
self.speed += 0.1;
}
}
};
});
// Poop class
var Poop = Container.expand(function () {
var self = Container.call(this);
var poopGraphics = self.attachAsset('poop', {
anchorX: 0.5,
anchorY: 0.5
});
self.reposition = function () {
self.x = Math.random();
self.y = Math.random();
};
});
// Spiral class
var Spiral = Container.expand(function () {
var self = Container.call(this);
self.radius = 100;
self.angle = 0;
self.speed = 0.01;
self.update = function () {
self.angle += self.speed;
self.x = 2048 / 2 + self.radius * Math.cos(self.angle);
self.y = 2732 / 2 + self.radius * Math.sin(self.angle);
if (self.y > 2732) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Display the player and enemy scores
var playerScoreTxt = new Text2('Player: 0', {
size: 150,
fill: "#0000ff"
});
playerScoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(playerScoreTxt);
var enemyScoreTxt = new Text2('Enemy: 0', {
size: 150,
fill: "#ff0000"
});
enemyScoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(enemyScoreTxt);
enemyScoreTxt.y = playerScoreTxt.height;
var road = game.addChild(LK.getAsset('road', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
}));
// Initialize score variables
var playerScore = 0;
var enemyScore = 0;
// Initialize variables
var car = new Car();
car.x = 2048 / 2;
car.y = 2732 / 2;
game.addChild(car);
var spirals = [];
var enemies = [];
for (var i = 0; i < 3; i++) {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = 2732 / 2 + 100;
enemies.push(enemy);
game.addChild(enemy);
}
// Handle touch events
game.down = function (x, y, obj) {
if (x < 2048 / 2) {
car.turnLeft();
} else {
car.turnRight();
}
};
game.up = function (x, y, obj) {
car.straighten();
};
// Update game state
game.update = function () {
car.update();
// Create spirals and poops
if (LK.ticks % 60 === 0) {
var spiral = new Spiral();
spiral.x = 2048 / 2;
spiral.y = -100;
spirals.push(spiral);
game.addChild(spiral);
var poopCount = spirals.filter(function (spiral) {
return spiral instanceof Poop;
}).length;
if (poopCount < 3) {
var poop = new Poop();
poop.x = 2048;
poop.y = 2732 / 2;
spirals.push(poop);
game.addChild(poop);
}
}
// Update spirals, poops and enemies
for (var i = spirals.length - 1; i >= 0; i--) {
if (spirals[i] instanceof Spiral) {
spirals[i].update();
}
if (car.intersects(spirals[i])) {
if (spirals[i] instanceof Poop) {
if (car.intersects(spirals[i])) {
spirals[i].reposition();
spirals[i].x = Math.random() * 2048;
spirals[i].y = Math.random() * 2732;
playerScore += 100; // Increase player score by 100 when poop is collected
} else if (enemies.some(function (enemy) {
return enemy.intersects(spirals[i]);
})) {
spirals[i].reposition();
spirals[i].x = Math.random() * 2048;
spirals[i].y = Math.random() * 2732;
enemyScore += 100; // Increase enemy score by 100 when poop is collected
}
} else {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
}
// Update enemies
for (var i = 0; i < enemies.length; i++) {
enemies[i].update();
}
};
// Update the displayed player and enemy scores
playerScoreTxt.setText('Player: ' + LK.getScore());
enemyScoreTxt.setText('Enemy: ' + enemyScore);
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.