Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'boxspacing is not defined' in or related to this line: 'b.y = offset + startY + i * (boxSize + boxspacing); // determine this' Line Number: 448
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'cBox is not defined' in or related to this line: 'cBox.width = cBox.height = tileSize;' Line Number: 428
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Set is not a constructor' in or related to this line: 'return n;' Line Number: 176
User prompt
Please fix the bug: 'Set is not a constructor' in or related to this line: 'return n;' Line Number: 176
User prompt
Please fix the bug: 'Set is not a constructor' in or related to this line: 'return n;' Line Number: 176
User prompt
Please fix the bug: 'Set is not a constructor' in or related to this line: 'return n;' Line Number: 176
User prompt
Please fix the bug: 'Set is not a constructor' in or related to this line: 'return n;' Line Number: 176
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: cosole is not defined' in or related to this line: 'cosole.log('levelContainer:', levelContainer);' Line Number: 126
Code edit (1 edits merged)
Please save this source code
Code edit (19 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: tween is not defined' in or related to this line: 'tween(self, {' Line Number: 110 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Arrow is not defined' in or related to this line: 'var arrow = new Arrow();' Line Number: 40
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: visited.has is not a function' in or related to this line: '_iterator.f();' Line Number: 268
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: neighbours is not defined' in or related to this line: 'console.log(neighbours);' Line Number: 254
===================================================================
--- original.js
+++ change.js
@@ -100,10 +100,11 @@
self.gridY = 0;
self.speed = 10;
self.outlier = false;
self.down = function (x, y, obj) {
- //console.log(x, y, obj);
- colorBoxClicked(self);
+ if (!self.outlier) {
+ colorBoxClicked(self);
+ }
};
self.remove = function (delay) {
currentLevel[self.gridY][self.gridX] = 0;
tween(self, {
@@ -349,9 +350,10 @@
var newY = y + dy;
// Check if the new position is within the grid boundaries
if (newX >= 0 && newX < currentLevel.length && newY >= 0 && newY < currentLevel[0].length) {
var colorBox = levelContainer.children.find(function (child) {
- return child.gridX === newX && child.gridY === newY;
+ //return child.gridX === newX && child.gridY === newY;
+ return !child.outlier && child.gridX === newX && child.gridY === newY;
});
if (colorBox) {
adjacentTiles.push(colorBox);
}
@@ -405,8 +407,23 @@
console.log(n);
if (n === 0) {
console.log('level cleared. TODO: write level cleared function.');
} else {
+ var startX = -board.width / 2;
+ var startY = -board.height / 2;
+ var boxSize = tileSize;
+ var boxSpacing = boxSize * spacingRatio;
+ var offset = boxSize / 2 + boxSpacing;
+ /*
+ for (var i = 0; i < gridSize; i++) {
+ for (var j = 0; j < gridSize; j++) {
+ var box = self.addChild(new Box());
+ box.width = box.height = boxSize;
+ box.x = offset + startX + i * (boxSize + boxSpacing);
+ box.y = offset + startY + j * (boxSize + boxSpacing);
+ box.setAlpha(0.075);
+ }
+ }*/
// Place an outlier tile at 50% (and minimum one) of the available positions.
var placedAtLeastOne = false;
console.log('ac:', availableCols);
availableCols = shuffleArray(availableCols);
@@ -417,17 +434,16 @@
// place it, either side will do.
var cIndex = colorsPresent[Math.floor(Math.random() * colorsPresent.length)];
var b = new ColorBox(cIndex);
b.outlier = true;
- var b = new ColorBox(cIndex);
b.width = b.height = tileSize;
if (Math.random() < 0.5) {
- b.x = -1000;
- b.y = 0; // determine this
+ b.x = -900;
+ b.y = offset + startY + i * (boxSize + boxspacing); // determine this
b.gridX = 0; // determine this
b.gridY = i;
} else {
- b.x = 1000;
+ b.x = 900;
b.y = 0; // determine this
b.gridX = 0; // determine this
b.gridY = i;
}
@@ -437,12 +453,31 @@
console.log('levelContainer is now:', levelContainer);
placedAtLeastOne = true;
}
}
- for (var i = 0; i < availableCols; i++) {
- if (Math.random() < 0.5) {
+ for (var i = 0; i < availableCols.length; i++) {
+ if (Math.random() < 0.5 || true) {
// place it, either side will do
- } else {}
+ var cIndex = colorsPresent[Math.floor(Math.random() * colorsPresent.length)];
+ var b = new ColorBox(cIndex);
+ b.outlier = true;
+ b.width = b.height = tileSize;
+ if (Math.random() < 0.5) {
+ b.x = 0;
+ b.y = -900; // determine this
+ b.gridX = i; // determine this
+ b.gridY = 0;
+ } else {
+ b.x = 0;
+ b.y = 900; // determine this
+ b.gridX = i; // determine this
+ b.gridY = 0;
+ }
+ console.log('b is:', b);
+ // Tween into place.
+ levelContainer.addChild(b);
+ console.log('levelContainer is now:', levelContainer);
+ }
}
}
// And place them. (Animate them in from sides.)
}
A large calm background drawing for a puzzle game, in dark calm blueish colors and non-confusing content. High definition. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A quadratic polished dark blue marble slate. Front perspective with right angles. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white question mark in a circle, like for a help button in a game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white X in a circle, like for a close window button in a game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A white questionmark on a black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A green check mark on a dark background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.