User prompt
fixed enemies speed 1
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'angle')' in or related to this line: 'self.angle = Math.random() * 2 * Math.PI;' Line Number: 192
User prompt
random line trajectory enemies
User prompt
random thraectory enemies
Code edit (1 edits merged)
Please save this source code
User prompt
lower speed enemies
User prompt
add enemies that steel poop
User prompt
max limit poop at one time is 3
User prompt
The score in the game not depends on Time Elapsed
User prompt
The car cannot leave the game area
User prompt
score raise after collect poop
User prompt
poop spawns randomly after collect
User prompt
replace score up
User prompt
add score at the center
User prompt
first poop spawns in right anle
User prompt
player collect poop and it spawns in other place
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: 122
User prompt
add poops that player must collect and get points
User prompt
at the start car in center
User prompt
delete obstackles
User prompt
add road on background
User prompt
add random spiral road
Initial prompt
F & F
===================================================================
--- original.js
+++ change.js
@@ -1,104 +1,119 @@
-/****
+/****
* 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;
- }
- self.x += self.speed * Math.cos(self.rotation);
- self.y += self.speed * Math.sin(self.rotation);
- };
- self.turnLeft = function () {
- self.direction = 1;
- };
- self.turnRight = function () {
- self.direction = 2;
- };
- self.straighten = function () {
- self.direction = 0;
- };
+ 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;
+ }
+ self.x += self.speed * Math.cos(self.rotation);
+ self.y += self.speed * Math.sin(self.rotation);
+ };
+ self.turnLeft = function () {
+ self.direction = 1;
+ };
+ self.turnRight = function () {
+ self.direction = 2;
+ };
+ self.straighten = function () {
+ self.direction = 0;
+ };
});
// Obstacle class
var Obstacle = Container.expand(function () {
- var self = Container.call(this);
- var obstacleGraphics = self.attachAsset('obstacle', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.update = function () {
- self.y += 5;
- if (self.y > 2732) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ self.y += 5;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
});
+// 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
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize variables
var car = new Car();
car.x = 2048 / 2;
car.y = 2732 - 200;
game.addChild(car);
-var obstacles = [];
+var spirals = [];
var score = 0;
var scoreTxt = new Text2('0', {
- size: 150,
- fill: "#ffffff"
+ size: 150,
+ fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Handle touch events
game.down = function (x, y, obj) {
- if (x < 2048 / 2) {
- car.turnLeft();
- } else {
- car.turnRight();
- }
+ if (x < 2048 / 2) {
+ car.turnLeft();
+ } else {
+ car.turnRight();
+ }
};
game.up = function (x, y, obj) {
- car.straighten();
+ car.straighten();
};
// Update game state
game.update = function () {
- car.update();
- // Create obstacles
- if (LK.ticks % 60 === 0) {
- var obstacle = new Obstacle();
- obstacle.x = Math.random() * 2048;
- obstacle.y = -100;
- obstacles.push(obstacle);
- game.addChild(obstacle);
- }
- // Update obstacles
- for (var i = obstacles.length - 1; i >= 0; i--) {
- obstacles[i].update();
- if (car.intersects(obstacles[i])) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- }
- // Update score
- score += 1;
- scoreTxt.setText(score);
+ car.update();
+ // Create spirals
+ if (LK.ticks % 60 === 0) {
+ var spiral = new Spiral();
+ spiral.x = 2048 / 2;
+ spiral.y = -100;
+ spirals.push(spiral);
+ game.addChild(spiral);
+ }
+ // Update spirals
+ for (var i = spirals.length - 1; i >= 0; i--) {
+ spirals[i].update();
+ if (car.intersects(spirals[i])) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ }
+ // Update score
+ score += 1;
+ scoreTxt.setText(score);
};
\ No newline at end of file
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.