User prompt
detect when cube stack is 1 cube short of spawn level and stop game
Code edit (1 edits merged)
Please save this source code
User prompt
when cube stack reach top then stop game
Code edit (5 edits merged)
Please save this source code
User prompt
remove unused variables
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 34
User prompt
Fix Bug: 'TypeError: self.parent.spawnCube is not a function' in this line: 'self.parent.spawnCube();' Line Number: 34
User prompt
Fix Bug: 'TypeError: self.parent.spawnCube is not a function' in this line: 'self.parent.spawnCube();' Line Number: 34
User prompt
Fix Bug: 'TypeError: self.parent.spawnCube is not a function' in this line: 'self.parent.spawnCube();' Line Number: 34
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 34
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 34
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 34
Code edit (5 edits merged)
Please save this source code
User prompt
add code to stop game when stack reaches 2300
User prompt
add code to stop game when cube stack reaches spawn level
User prompt
add code for when cube interacts with side of another cube and initiate spawning of new cube
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
remove spawn duplication
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: otherCube is not defined' in this line: 'if (otherCube) {' Line Number: 6
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: otherCube is not defined' in this line: 'if (otherCube) {' Line Number: 6
User prompt
add start button that when pressed will spawn first cube
User prompt
Fix Bug: 'Uncaught ReferenceError: otherCube is not defined' in this line: 'if (otherCube) {' Line Number: 6
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,14 @@
var Cube = Container.expand(function () {
var self = Container.call(this);
+ self.spawnCube = function () {
+ var newCube = new Cube();
+ newCube.x = 1024;
+ newCube.y = 300;
+ newCube.speed = cubeSpeed;
+ cubes.push(newCube);
+ self.addChild(newCube);
+ };
var cubeGraphics = self.createAsset('cube', 'Cube Graphics', .5, .5);
cubeGraphics.tint = Math.floor(Math.random() * 16777215);
self.speed = 0;
self.move = function (direction) {
@@ -21,18 +29,18 @@
} else {
self.x = otherCube.x + otherCube.width;
}
self.speed = 0;
- self.parent.self.parent.self.parent.parent.spawnCube();
+ self.spawnCube();
} else {
self.y = otherCube.y - self.height;
self.speed = 0;
- self.parent.parent.spawnCube();
+ spawnCube();
}
} else if (self.y + self.height >= 2732) {
self.y = 2732 - self.height;
self.speed = 0;
- self.parent.spawnCube();
+ spawnCube();
}
};
self.intersectsWith = function (otherCube) {
var intersects = self.x < otherCube.x + otherCube.width && self.x + self.width > otherCube.x && self.y < otherCube.y + otherCube.height && self.y + self.height > otherCube.y;
arrow pointing left, transparent background, cartoon style, no shadow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white square, 2d in-game asset, blank background, high contrast, no shadows, single game texture Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
vertical slider. 1000 pixels tall and 50 pixels wide. with numbers 1 at top and 10 at bottom. 2d in-game asset. blank background no shadows. high contrast Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white square, 2d in-game asset, blank background, high contrast, no shadows, single game texture Single Game Texture. With word DROP in middle Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
background image 2732 high x 2048 wide. high contrast, light cartoon image of colored stacked cubes. out in open fields. Single Game Texture. In-Game asset. 3d. High contrast. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
stone square, bevelled edges. 2d in-game asset, blank background, high contrast, no shadows, single-game texture. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Triangle pointing left, transparent background, cartoon style, no shadow Single Game Texture. In-Game asset. 2d. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.