Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'levelContainer.children.findAll is not a function' in or related to this line: 'var outliers = levelContainer.children.findAll(function (child) {' Line Number: 548
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -273,8 +273,9 @@
return n;
}
var GAME_IS_CLICKABLE = true; // flag for when board is clickable and when not.
var numRunningTweens = 0; // input is blocked while tweens running, so increment this when a tween starts, nd decrement when tween ends.
+var outlierDirectionCounter = 0; // increment to allow outliers spawning on different side each turn.
var playerScore = 0;
var colors = ['0x000000', '0xffffff', '0xffff00'];
var gridSize = 7;
var spacingRatio = 0.2;
@@ -434,72 +435,70 @@
var startY = -boardSize / 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);
+ //console.log('ac:', availableCols);
availableCols = shuffleArray(availableCols);
availableRows = shuffleArray(availableRows);
- console.log('ac:', availableCols);
- for (var i = 0; i < availableRows.length; i++) {
- if (Math.random() < 0.5 || !placedAtLeastOne) {
- // place it, either side will do.
- 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 = -900;
- b.y = offset + startY + availableRows[i] * (boxSize + boxSpacing);
- b.gridX = -1;
- b.gridY = availableRows[i];
- } else {
- b.x = 900;
- b.y = offset + startY + availableRows[i] * (boxSize + boxSpacing);
- b.gridX = 99;
- b.gridY = availableRows[i];
+ //console.log('ac:', availableCols);
+ var currentDirection = outlierDirectionCounter % 4;
+ outlierDirectionCounter++; // increment, so we get a new direction next turn.
+ if (currentDirection == 1 || currentDirection == 3) {
+ for (var i = 0; i < availableRows.length; i++) {
+ //if (Math.random() < 0.5 || !placedAtLeastOne) {
+ if (true || !placedAtLeastOne) {
+ // place it, either side will do.
+ var cIndex = colorsPresent[Math.floor(Math.random() * colorsPresent.length)];
+ var b = new ColorBox(cIndex);
+ b.outlier = true;
+ b.width = b.height = tileSize;
+ if (currentDirection == 3) {
+ b.x = -900;
+ b.y = offset + startY + availableRows[i] * (boxSize + boxSpacing);
+ b.gridX = -1;
+ b.gridY = availableRows[i];
+ } else {
+ b.x = 900;
+ b.y = offset + startY + availableRows[i] * (boxSize + boxSpacing);
+ b.gridX = 99;
+ b.gridY = availableRows[i];
+ }
+ b.fadeIn();
+ //console.log('b is:', b);
+ levelContainer.addChild(b);
+ //console.log('levelContainer is now:', levelContainer);
+ placedAtLeastOne = true;
}
- b.fadeIn();
- //console.log('b is:', b);
- levelContainer.addChild(b);
- //console.log('levelContainer is now:', levelContainer);
- placedAtLeastOne = true;
}
- }
- for (var i = 0; i < availableCols.length; i++) {
- if (Math.random() < 0.5 || true) {
- // place it, either side will do
- 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 = offset + startX + availableCols[i] * (boxSize + boxSpacing);
- b.y = -900;
- b.gridX = availableCols[i];
- b.gridY = -1;
- } else {
- b.x = offset + startX + availableCols[i] * (boxSize + boxSpacing);
- ;
- b.y = 900;
- b.gridX = availableCols[i];
- b.gridY = 99;
+ } else {
+ for (var i = 0; i < availableCols.length; i++) {
+ //if (Math.random() < 0.5 || !placedAtLeastOne) {
+ if (true || !placedAtLeastOne) {
+ // place it, either side will do
+ var cIndex = colorsPresent[Math.floor(Math.random() * colorsPresent.length)];
+ var b = new ColorBox(cIndex);
+ b.outlier = true;
+ b.width = b.height = tileSize;
+ if (currentDirection == 0) {
+ b.x = offset + startX + availableCols[i] * (boxSize + boxSpacing);
+ b.y = -900;
+ b.gridX = availableCols[i];
+ b.gridY = -1;
+ } else {
+ b.x = offset + startX + availableCols[i] * (boxSize + boxSpacing);
+ ;
+ b.y = 900;
+ b.gridX = availableCols[i];
+ b.gridY = 99;
+ }
+ b.fadeIn();
+ //console.log('b is:', b);
+ levelContainer.addChild(b);
+ //console.log('levelContainer is now:', levelContainer);
+ placedAtLeastOne = true;
}
- b.fadeIn();
- //console.log('b is:', b);
- levelContainer.addChild(b);
- //console.log('levelContainer is now:', levelContainer);
}
}
}
// And place them. (Animate them in from sides.)
@@ -538,14 +537,35 @@
}
placeOutliers();
function moveIn() {
// Move all outliers onto stage
- var outliers = levelContainer.children.find(function (child) {
+ var outliers = levelContainer.children.filter(function (child) {
return child.outlier;
});
console.log('there are ', outliers.length, 'outliers');
+ for (var i = 0; i < outliers.length; i++) {
+ var t = outliers[i];
+ var newPos;
+ // Determine direction the outlier is moving in, in order to determine position to tween to.
+ if (t.gridX == -1) {
+ // do something
+ } else if (t.gridX = 99) {
+ // do something
+ } else if (t.gridY == -1) {
+ newPos = gridSize;
+ for (var j = gridSize - 1; j > 0; j--) {
+ if (currentLevel[t.gridX][j] != 0) {
+ newPos = j - 1;
+ }
+ }
+ console.log(t, 'would move to position', newPos);
+ } else if (t.gridY == 99) {
+ // do something
+ }
+ }
// Once in place, add them to currentLevel object. (or delete if flown ofscreen)
}
+moveIn();
game.update = function () {
if (LK.ticks % 12 == 0) {
//console.log(numRunningTweens);
if (numRunningTweens > 0) {
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.