User prompt
Fix Bug: 'TypeError: poles[i].cubes[j].update is not a function' in or related to this line: 'poles[i].cubes[j].update();' Line Number: 179
User prompt
Fix Bug: 'TypeError: poles[i].cubes[j].update is not a function' in or related to this line: 'poles[i].cubes[j].update();' Line Number: 179
User prompt
place cube_collapse randomly at the top of some columns
User prompt
inside some columns there should be empty space in random order where the cubes were
User prompt
Fix Bug: 'Timeout.tick error: Cannot set properties of null (setting 'isFalling')' in or related to this line: 'self.cubes[index].isFalling = true;' Line Number: 38
User prompt
Fix Bug: 'Timeout.tick error: Cannot set properties of null (setting 'isFalling')' in or related to this line: 'self.cubes[index].isFalling = true;' Line Number: 38
User prompt
inside some columns there should be empty space in random order where the cubes were
User prompt
There should be cubes missing randomly inside some columns
User prompt
the height of the column should differ from the previous column by no more than one cube
User prompt
columns should sometimes be missing cubes in random order
User prompt
the columns in the middle should sometimes be missing cubes in a random order
User prompt
the height of the column should differ from the previous column by no more than one cube
User prompt
герой должен взаимодействовать также с левой гранью куба на его пути
User prompt
the hero must move horizontally in sync with the cubes
User prompt
the hero must move horizontally in sync with the cubes
User prompt
the hero must fall to the top surface of the first cube he encounters
User prompt
the hero must fall to the first cube he encounters
User prompt
assign weight to the hero
User prompt
when the hero leaves the column, he must fall to the top surface of the cube that is below
User prompt
when the hero leaves the column, he must fall to the top surface of the cube that is below
User prompt
when the hero leaves the column he must fall to the top surface of the cube below
User prompt
the hero moves along the top surface of the cubes
User prompt
the hero falls until he lands on the cube
User prompt
cancel the automatic movement of the hero to the top, the hero must fall down if he does not get to the top as a result of a jump
User prompt
the hero must fall down if he does not get to the top as a result of a jump
===================================================================
--- original.js
+++ change.js
@@ -20,15 +20,13 @@
// Class for the poles consisting of cubes
var Pole = Container.expand(function () {
var self = Container.call(this);
self.cubes = [];
- self.addCube = function (shouldAddCube) {
- if (shouldAddCube) {
- var cube = new Cube();
- cube.y = -(self.cubes.length * 100) - (self.cubes.length - 1) * 2;
- self.addChild(cube);
- self.cubes.push(cube);
- }
+ self.addCube = function () {
+ var cube = new Cube();
+ cube.y = -(self.cubes.length * 100) - (self.cubes.length - 1) * 2;
+ self.addChild(cube);
+ self.cubes.push(cube);
};
self.makeCubesFall = function () {
for (var i = self.cubes.length - 1; i >= 0; i--) {
(function (index) {
@@ -95,10 +93,10 @@
/****
* Game Code
****/
-// Initialize important asset arrays
// Initialize assets used in the game.
+// Initialize important asset arrays
var poles = [];
var hero;
// Create the hero
hero = game.addChild(new Hero());
@@ -113,11 +111,10 @@
var pole = game.addChild(new Pole());
pole.x = i * poleWidth;
pole.y = 2732 - 50; // Align base of pole with bottom of the screen and raise by 50 pixels
for (var j = 0; j < 10; j++) {
- // Randomly decide whether to add a cube or not
- var shouldAddCube = Math.random() > 0.2; // 80% chance to add a cube
- pole.addCube(shouldAddCube);
+ // Add 10 cubes to each pole to make them higher
+ pole.addCube();
}
poles.push(pole);
}
}
@@ -147,16 +144,14 @@
poles.shift();
var newPole = game.addChild(new Pole());
newPole.x = poles[poles.length - 1].x + poleWidth;
newPole.y = 2732 - 50;
- var previousPoleHeight = poles[poles.length - 1].cubes.length;
- var minCubes = Math.max(6, previousPoleHeight - 1);
- var maxCubes = Math.min(14, previousPoleHeight + 1);
+ var prevPoleHeight = poles[poles.length - 1].cubes.length;
+ var minCubes = Math.max(6, prevPoleHeight - 1);
+ var maxCubes = Math.min(14, prevPoleHeight + 1);
var cubesCount = Math.floor(Math.random() * (maxCubes - minCubes + 1)) + minCubes;
for (var j = 0; j < cubesCount; j++) {
- // Randomly decide whether to add a cube or not
- var shouldAddCube = Math.random() > 0.2; // 80% chance to add a cube
- newPole.addCube(shouldAddCube);
+ newPole.addCube();
}
poles.push(newPole);
}
// Move poles to the left to simulate hero running and make cubes fall after passing the middle
girl sitting on Wrecking Ball, cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
construction cranes on the sides of the frame, depth of field blur, cartoon style, black and white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"ALARM" text bubble, comic style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is gray, concrete with a black square in the center. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Wrecking Ball with eyes, cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is red, concrete with a black square in the center.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"ALARM" text bubble yellow, comic book style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is yellow, concrete with a black square in the center. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.