Code edit (3 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 a button at the top that triggers the cube spawn routine
User prompt
Fix Bug: 'ReferenceError: otherCube is not defined' in this line: 'if (otherCube) {' Line Number: 6
User prompt
add at top a button to spawn a cube
User prompt
add button to drop cube
User prompt
Fix Bug: 'Uncaught ReferenceError: spawnCube is not defined' in this line: 'startButton.on('down', spawnCube);' Line Number: 68
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 41
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 41
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 33
User prompt
detect when cube reaches bottom and spawn next cube#
User prompt
Fix Bug: 'ReferenceError: cubes is not defined' in this line: 'cubes.push(newCube);' Line Number: 8
User prompt
Fix Bug: 'ReferenceError: cubeSpeed is not defined' in this line: 'newCube.speed = cubeSpeed;' Line Number: 7
User prompt
Fix Bug: 'ReferenceError: spawnCube is not defined' in this line: 'spawnCube();' Line Number: 28
User prompt
add cube respawn when cube reaches bottom
User prompt
when the cube reaches the bottom or is stacked on top or against the side of another cube then respawn a new cube
User prompt
rewrite side interaction so cube stops and a new cube is spawned
User prompt
Add start button at top of screen to swanp first cube when pressed
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- 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) {
@@ -16,17 +24,17 @@
self.stack = function (otherCube, intersection) {
if (otherCube) {
if (intersection === 'side') {
self.speed = 0;
- spawnCube();
+ self.spawnCube();
} else {
self.y = otherCube.y - self.height;
self.speed = 0;
}
} else if (self.y + self.height >= 2732) {
self.y = 2732 - self.height;
self.speed = 0;
- spawnCube();
+ self.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.