Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'levelNameLabel is not defined' in or related to this line: 'if (Math.random() < 0.12) {' Line Number: 403
User prompt
Please fix the bug: 'levelNameLabel is not defined' in or related to this line: 'levelNameLabel.setText(a.name, ' ', a.uid);' Line Number: 984
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'var n = source[0].length;' Line Number: 1219
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'var m = source.length;' Line Number: 1218
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'var gridSize = currentLevel.d.length;' Line Number: 1087
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'for (var j = 0; j < a.d[0].length; j++) {' Line Number: 965
User prompt
Please fix the bug: 'levels[currentLevelID].map is not a function' in or related to this line: 'for (var i = 0; i < a.d.length; i++) {' Line Number: 964
User prompt
Please fix the bug: 'levels[currentLevelID].map is not a function' in or related to this line: 'var currentLevel = levels[currentLevelID].map(function (arr) {' Line Number: 935
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'tint')' in or related to this line: 'self.boxGraphics.tint = 0x222222;' Line Number: 152
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'tint')' in or related to this line: 'self.boxGraphics.tint = 0xffffff;' Line Number: 146
Code edit (1 edits merged)
Please save this source code
Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'instructions is not defined' in or related to this line: 'game.addChild(instructions);' Line Number: 761
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: particleGraphics.setScale is not a function' in or related to this line: 'particleGraphics.setScale(sc, sc);' Line Number: 314
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
please make the particles move upwards in a wavy pattern instead of straight like now. Use individual amplitude for particles so they don't all move exactly the same.
User prompt
Please fix the bug: 'ReferenceError: particleGraphicsGraphics is not defined' in or related to this line: 'self.addChild(particleGraphicsGraphics);' Line Number: 313
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (self.particles.length < self.particlesMax) {' Line Number: 329
===================================================================
--- original.js
+++ change.js
@@ -125,9 +125,9 @@
}
};
self.remove = function (delay) {
numRunningTweens++;
- currentLevel[self.gridY][self.gridX] = 0;
+ currentLevel.d[self.gridY][self.gridX] = 0;
tween(self, {
scaleX: 0.5,
scaleY: 0.5,
rotation: Math.PI,
@@ -153,15 +153,16 @@
});
//self.destroy();
};
self.fadeIn = function () {
+ var delayBy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
numRunningTweens++;
self.alpha = 0;
tween(self, {
alpha: 1
}, {
duration: BASE_TWEEN_SPEED,
- delay: 0,
+ delay: delayBy,
easing: tween.easeInOut,
onFinish: function onFinish() {
numRunningTweens--;
//console.log('faded in:', self);
@@ -215,21 +216,35 @@
});
};
self.enterBoard = function (destX, destY, delayFactor) {
numRunningTweens++;
+ self.width = 0;
+ self.height = 0;
+ self.x = destX;
+ self.y = destY;
tween(self, {
- x: destX,
- y: destY
+ width: tileSize,
+ height: tileSize
}, {
duration: BASE_TWEEN_SPEED,
delay: delayFactor,
easing: tween.easeInOut,
onFinish: function onFinish() {
numRunningTweens--;
- //currentLevel[self.gridY][self.gridX] = self.colorIndex;
- //self.outlier = false;
}
});
+ /*
+ tween(self, {
+ x: destX,
+ y: destY
+ }, {
+ duration: BASE_TWEEN_SPEED,
+ delay: delayFactor,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ numRunningTweens--;
+ }
+ });*/
};
self.moveInPosition = function () {
var startX = -boardSize / 2;
var startY = -boardSize / 2;
@@ -247,9 +262,9 @@
delay: 0,
easing: tween.easeInOut,
onFinish: function onFinish() {
numRunningTweens--;
- currentLevel[self.gridY][self.gridX] = self.colorIndex;
+ currentLevel.d[self.gridY][self.gridX] = self.colorIndex;
self.outlier = false;
//console.log('done moving into position');
}
});
@@ -427,10 +442,10 @@
/****
* Game Code
****/
-//LK.init.music('backgroundMusic')
//LK.init.sound('testmusic', {volume:1, start:0, end:0.995, id:'676c4b01fd1ad619bb4ea263'})
+//LK.init.music('backgroundMusic')
var lerp = function lerp(start, end, t) {
return start * (1 - t) + end * t;
};
// Play test music in a loop
@@ -660,56 +675,224 @@
var colors = ['0x000000', '0xffffff', '0xffff00', '0xff0000', '0x0000dd', '0x00ff00', '0xff00ff', '0xbbbbbb', '0x827364', '0xecbcb4'];
var tileSprites = ['box', 'tileWhite', 'tileYellow', 'tileRed', 'tileBlue', 'tileGreen', 'tilePurple', 'tileGray', 'tileBrown', 'tileBeige'];
var tileTypes = tileSprites; // Define tileTypes to fix the error
// 5x5 levels.
-var l1a = [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 2, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]];
-var l1b = [[0, 0, 0, 0, 0], [0, 0, 4, 0, 0], [0, 5, 4, 5, 0], [0, 5, 0, 5, 0], [0, 0, 0, 0, 0]];
-var l1c = [[0, 0, 0, 0, 0], [0, 3, 0, 3, 0], [0, 0, 2, 0, 0], [0, 3, 0, 3, 0], [0, 0, 0, 0, 0]];
-var l1d = [[0, 0, 0, 0, 0], [0, 6, 4, 6, 0], [0, 4, 0, 4, 0], [0, 6, 4, 6, 0], [0, 0, 0, 0, 0]];
-var l1e = [[0, 0, 0, 0, 0], [0, 0, 0, 5, 0], [0, 0, 5, 3, 0], [0, 5, 3, 3, 0], [0, 0, 0, 0, 0]];
-var l1f = [[0, 0, 7, 7, 7], [0, 0, 0, 8, 7], [0, 0, 8, 0, 7], [0, 8, 0, 0, 0], [0, 0, 0, 0, 0]];
-var l1g = [[0, 0, 1, 0, 0], [0, 0, 3, 0, 0], [0, 3, 3, 3, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]];
+var l1a = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 2, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]]
+};
+var l1b = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0], [0, 0, 4, 0, 0], [0, 5, 4, 5, 0], [0, 5, 0, 5, 0], [0, 0, 0, 0, 0]]
+};
+var l1c = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0], [0, 3, 0, 3, 0], [0, 0, 2, 0, 0], [0, 3, 0, 3, 0], [0, 0, 0, 0, 0]]
+};
+var l1d = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0], [0, 6, 4, 6, 0], [0, 4, 0, 4, 0], [0, 6, 4, 6, 0], [0, 0, 0, 0, 0]]
+};
+var l1e = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0], [0, 0, 0, 5, 0], [0, 0, 5, 3, 0], [0, 5, 3, 3, 0], [0, 0, 0, 0, 0]]
+};
+var l1f = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 7, 7, 7], [0, 0, 0, 8, 7], [0, 0, 8, 0, 7], [0, 8, 0, 0, 0], [0, 0, 0, 0, 0]]
+};
+var l1g = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 1, 0, 0], [0, 0, 3, 0, 0], [0, 3, 3, 3, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]
+};
// 6x6 levels
-var l2a = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 4, 1, 1, 4, 0], [0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
-var l2b = [[0, 0, 0, 0, 0, 0], [0, 0, 8, 8, 0, 0], [0, 8, 8, 8, 6, 0], [0, 8, 8, 8, 8, 0], [0, 9, 0, 0, 9, 0], [0, 0, 0, 0, 0, 0]];
-var l2c = [[0, 0, 0, 0, 0, 0], [0, 9, 9, 9, 9, 0], [0, 4, 9, 9, 4, 0], [0, 9, 6, 6, 9, 0], [0, 9, 9, 9, 9, 0], [0, 0, 0, 0, 0, 0]];
-var l2d = [[0, 0, 0, 0, 0, 0], [0, 4, 2, 2, 4, 0], [0, 0, 3, 2, 0, 0], [0, 2, 2, 2, 2, 0], [0, 2, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0]];
-var l2e = [[0, 0, 0, 0, 0, 0], [0, 5, 5, 6, 0, 0], [0, 5, 6, 3, 6, 0], [0, 6, 3, 6, 3, 0], [0, 0, 6, 3, 6, 0], [0, 0, 0, 0, 0, 0]];
-var l2f = [[0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 0], [0, 7, 4, 7, 4, 0], [0, 7, 7, 3, 7, 0], [0, 0, 7, 7, 0, 0], [0, 0, 0, 0, 0, 0]];
-var l2g = [[0, 0, 0, 0, 0, 0], [0, 3, 0, 3, 2, 0], [0, 3, 3, 2, 9, 0], [0, 3, 3, 2, 0, 0], [0, 3, 0, 3, 0, 0], [0, 0, 0, 0, 0, 0]];
+var l2a = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0], [0, 4, 1, 1, 4, 0], [0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2b = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 0, 8, 8, 0, 0], [0, 8, 8, 8, 6, 0], [0, 8, 8, 8, 8, 0], [0, 9, 0, 0, 9, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2c = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 9, 9, 9, 9, 0], [0, 4, 9, 9, 4, 0], [0, 9, 6, 6, 9, 0], [0, 9, 9, 9, 9, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2d = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 4, 2, 2, 4, 0], [0, 0, 3, 2, 0, 0], [0, 2, 2, 2, 2, 0], [0, 2, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2e = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 5, 5, 6, 0, 0], [0, 5, 6, 3, 6, 0], [0, 6, 3, 6, 3, 0], [0, 0, 6, 3, 6, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2f = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 7, 0, 7, 0, 0], [0, 7, 4, 7, 4, 0], [0, 7, 7, 3, 7, 0], [0, 0, 7, 7, 0, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2g = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0], [0, 3, 0, 3, 2, 0], [0, 3, 3, 2, 9, 0], [0, 3, 3, 2, 0, 0], [0, 3, 0, 3, 0, 0], [0, 0, 0, 0, 0, 0]]
+};
// 7x7 levels
-var l3a = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 8, 0, 0], [0, 8, 8, 0, 8, 8, 0], [0, 0, 7, 7, 7, 0, 0], [0, 0, 4, 7, 4, 0, 0], [0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3b = [[0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 0], [0, 3, 3, 9, 9, 3, 0], [0, 3, 4, 9, 4, 3, 0], [0, 3, 9, 9, 9, 3, 0], [0, 3, 9, 9, 9, 3, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3c = [[0, 0, 0, 0, 0, 0, 0], [0, 7, 9, 9, 9, 7, 0], [0, 7, 5, 9, 5, 7, 0], [0, 9, 9, 9, 9, 9, 0], [0, 9, 6, 6, 6, 9, 0], [0, 0, 9, 9, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3d = [[0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 2, 0], [0, 2, 1, 0, 2, 2, 0], [0, 2, 2, 2, 2, 2, 0], [0, 3, 8, 3, 8, 3, 0], [0, 8, 2, 2, 2, 8, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3e = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 6, 6, 6, 0, 0], [0, 6, 3, 2, 3, 6, 0], [0, 6, 2, 2, 2, 6, 0], [0, 6, 3, 2, 3, 6, 0], [0, 0, 6, 6, 6, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3f = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 9, 8, 9, 0, 0], [0, 0, 2, 9, 2, 0, 0], [0, 9, 8, 8, 8, 9, 0], [0, 0, 8, 8, 8, 0, 0], [0, 0, 7, 0, 7, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
-var l3g = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 5, 5, 0, 0], [0, 5, 3, 5, 3, 5, 0], [0, 5, 5, 3, 5, 5, 0], [0, 0, 0, 8, 0, 0, 0], [0, 0, 0, 8, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
+var l3a = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 8, 0, 0], [0, 8, 8, 0, 8, 8, 0], [0, 0, 7, 7, 7, 0, 0], [0, 0, 4, 7, 4, 0, 0], [0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3b = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 3, 3, 3, 0], [0, 3, 3, 9, 9, 3, 0], [0, 3, 4, 9, 4, 3, 0], [0, 3, 9, 9, 9, 3, 0], [0, 3, 9, 9, 9, 3, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3c = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 7, 9, 9, 9, 7, 0], [0, 7, 5, 9, 5, 7, 0], [0, 9, 9, 9, 9, 9, 0], [0, 9, 6, 6, 6, 9, 0], [0, 0, 9, 9, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3d = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 2, 0], [0, 2, 1, 0, 2, 2, 0], [0, 2, 2, 2, 2, 2, 0], [0, 3, 8, 3, 8, 3, 0], [0, 8, 2, 2, 2, 8, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3e = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 6, 6, 6, 0, 0], [0, 6, 3, 2, 3, 6, 0], [0, 6, 2, 2, 2, 6, 0], [0, 6, 3, 2, 3, 6, 0], [0, 0, 6, 6, 6, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3f = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 9, 8, 9, 0, 0], [0, 0, 2, 9, 2, 0, 0], [0, 9, 8, 8, 8, 9, 0], [0, 0, 8, 8, 8, 0, 0], [0, 0, 7, 0, 7, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3g = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 5, 5, 0, 0], [0, 5, 3, 5, 3, 5, 0], [0, 5, 5, 3, 5, 5, 0], [0, 0, 0, 8, 0, 0, 0], [0, 0, 0, 8, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
// 8x8 levels
//var l4 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, 0], [0, 0, 2, 2, 0, 0, 0, 0], [0, 0,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0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 0, 3, 2, 0, 0, 0], [0, 0, 3, 0, 0, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
-var l4f = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 0, 2, 0, 2, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 6, 6, 6, 6, 6, 6, 0], [0, 2, 2, 2, 2, 2, 2, 0], [0, 6, 6, 6, 6, 6, 6, 0], [0, 3, 3, 3, 3, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
-var l4g = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 3, 4, 4, 3, 0, 0], [0, 3, 4, 2, 2, 4, 3, 0], [0, 4, 4, 4, 4, 4, 4, 0], [0, 2, 4, 6, 6, 4, 2, 0], [0, 4, 4, 6, 6, 4, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
+var l4a = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 4, 0, 0, 0], [0, 0, 4, 4, 4, 4, 0, 0], [0, 2, 7, 2, 7, 2, 7, 0], [0, 0, 4, 4, 4, 4, 0, 0], [0, 4, 0, 0, 0, 0, 4, 0], [0, 4, 0, 0, 0, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4b = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 2, 2, 2, 2, 2, 2, 0], [0, 2, 1, 3, 3, 3, 2, 0], [0, 2, 1, 3, 3, 3, 2, 0], [0, 0, 2, 2, 2, 2, 0, 0], [0, 0, 0, 1, 2, 0, 0, 0], [0, 0, 0, 1, 2, 0, 0, 0], [0, 0, 1, 2, 1, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4c = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 5, 0, 0, 0, 0], [0, 5, 4, 4, 5, 5, 5, 0], [0, 5, 5, 5, 1, 3, 1, 0], [0, 5, 5, 3, 3, 1, 3, 0], [0, 5, 5, 5, 5, 5, 5, 0], [0, 0, 5, 5, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4d = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 9, 1, 1, 9, 1, 0], [0, 9, 4, 9, 9, 4, 9, 0], [0, 1, 1, 9, 9, 1, 1, 0], [0, 9, 1, 1, 1, 1, 9, 0], [0, 1, 1, 3, 3, 1, 1, 0], [0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0]]
+};
+var l4e = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 4, 3, 2, 4, 0, 0], [0, 3, 0, 3, 2, 0, 3, 0], [0, 0, 2, 3, 3, 2, 0, 0], [0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 0, 3, 2, 0, 0, 0], [0, 0, 3, 0, 0, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4f = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 0, 2, 0, 2, 0], [0, 1, 1, 1, 1, 1, 1, 0], [0, 6, 6, 6, 6, 6, 6, 0], [0, 2, 2, 2, 2, 2, 2, 0], [0, 6, 6, 6, 6, 6, 6, 0], [0, 3, 3, 3, 3, 3, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4g = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 3, 4, 4, 3, 0, 0], [0, 3, 4, 2, 2, 4, 3, 0], [0, 4, 4, 4, 4, 4, 4, 0], [0, 2, 4, 6, 6, 4, 2, 0], [0, 4,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, 4, 4, 4, 4, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5b = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 2, 2, 8, 8, 8, 0, 0], [0, 2, 8, 2, 4, 8, 8, 2, 0], [0, 2, 0, 2, 4, 8, 0, 2, 0], [0, 0, 8, 2, 4, 8, 2, 0, 0], [0, 0, 0, 8, 2, 8, 0, 0, 0], [0, 0, 0, 0, 8, 0, 0, 0, 0], [0, 0, 0, 8, 8, 8, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5c = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 7, 7, 7, 7, 7, 7, 0], [0, 7, 4, 4, 4, 4, 4, 7, 0], [0, 7, 4, 4, 3, 3, 4, 7, 0], [0, 7, 3, 3, 3, 3, 3, 7, 0], [0, 7, 7, 7, 7, 7, 2, 7, 0], [0, 0, 0, 4, 4, 4, 0, 0, 0], [0, 0, 7, 7, 7, 7, 7, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5d = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 8, 8, 8, 8, 0, 0], [0, 8, 8, 8, 8, 8, 8, 8, 0], [0, 0, 5, 5, 3, 3, 5, 0, 0], [0, 2, 2, 5, 2, 3, 2, 0, 0], [0, 0, 3, 2, 5, 2, 5, 5, 0], [0, 8, 8, 8, 8, 2, 8, 8, 0], [0, 0, 8, 8, 8, 8, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5e = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 3, 3, 1, 3, 3, 3, 3, 0], [0, 3, 3, 1, 3, 3, 3, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0, 0], [0, 3, 3, 1, 3, 3, 3, 0, 0], [0, 3, 3, 1, 3, 3, 3, 3, 0], [0, 8, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5f = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 4, 1, 1, 4, 0, 0], [0, 5, 5, 4, 4, 4, 5, 4, 0], [0, 8, 5, 5, 4, 4, 5, 5, 0], [0, 5, 8, 4, 4, 5, 5, 2, 0], [0, 4, 5, 4, 4, 4, 5, 8, 0], [0, 4, 4, 5, 4, 4, 4, 4, 0], [0, 0, 4, 4, 4, 1, 4, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5g = {
+ name: 'test',
+ uid: 0,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 7, 0, 0, 0, 7, 7, 0], [0, 8, 7, 7, 8, 7, 7, 8, 0], [0, 7, 2, 4, 7, 2, 4, 7, 0], [0, 7, 2, 4, 7, 2, 4, 7, 0], [0, 8, 7, 7, 8, 7, 7, 8, 0], [0, 7, 7, 8, 8, 8, 7, 7, 0], [0, 0, 8, 7, 7, 7, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
// 10x10 levels
-var l6a = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 4, 5, 6, 0, 0, 0], [0, 0, 8, 4, 5, 6, 7, 8, 0, 0], [0, 2, 8, 4, 4, 5, 6, 7, 8, 0], [0, 8, 4, 4, 5, 5, 6, 7, 8, 0], [0, 4, 4, 5, 6, 7, 8, 2, 2, 0], [0, 4, 5, 6, 7, 8, 2, 2, 8, 0], [0, 0, 6, 7, 8, 2, 2, 8, 0, 0], [0, 0, 0, 7, 8, 2, 2, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
-var l6b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, 4, 0, 0], [0, 0, 0, 4, 4, 4, 4, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
// Levels ordered by grid size, for shuffling while maintining difficulty ramping.
var levels5 = [l1a, l1b, l1c, l1d, l1e, l1f, l1g];
var levels6 = [l2a, l2b, l2c, l2d, l2e, l2f, l2g];
var levels7 = [l3a, l3b, l3c, l3d, l3e, l3f, l3g];
@@ -721,9 +904,9 @@
//var levels = [l1a, l6g, l6b, l6c, l6d, l1b, l1c, l1d, l1e, l1f, l1g, l2a, l2b, l2c, l2d, l2e, l2f, l2g, l3a, l3b, l3c, l3d, l3e, l3f, l3g, l4a, l4b, l4c, l4d, l4e, l4f, l4g, l5a, l5b, l5c, l5d, l5e, l5f, l5g, l6a, l6b, l6c, l6d, l6e, l6f, l6g];
var levels = randomLevelSelection();
var currentLevelID = 0;
// Copy without reference, so we have original for retry/level reset.
-var currentLevel = levels[currentLevelID].map(function (arr) {
+var currentLevel = levels[currentLevelID].d.map(function (arr) {
return Array.isArray(arr) ? arr.slice() : [];
});
var stars = [];
var latestRemoveCount = 0;
@@ -749,28 +932,31 @@
var startY = -boardSize / 2;
var boxSize = tileSize;
var boxSpacing = boxSize * spacingRatio;
var offset = boxSize / 2 + boxSpacing;
- for (var i = 0; i < a.length; i++) {
- for (var j = 0; j < a[0].length; j++) {
- if (a[j][i] != 0) {
- var cBox = levelContainer.addChild(new ColorBox(a[j][i]));
+ var delayCounter = 0;
+ for (var i = 0; i < a.d.length; i++) {
+ for (var j = 0; j < a.d[0].length; j++) {
+ if (a.d[j][i] != 0) {
+ var cBox = levelContainer.addChild(new ColorBox(a.d[j][i]));
cBox.width = cBox.height = boxSize;
//cBox.x = offset + startX + i * (boxSize + boxSpacing);
//cBox.y = offset + startY + j * (boxSize + boxSpacing);
cBox.gridX = i;
cBox.gridY = j;
var destX = offset + startX + i * (boxSize + boxSpacing);
var destY = offset + startY + j * (boxSize + boxSpacing);
- var delayFactor = 80 * i + j * 80;
- cBox.x = -1500;
- cBox.y = destY;
+ var delayFactor = delayCounter;
+ delayCounter += 60;
+ //cBox.x = -1500;
+ //cBox.y = destY;
cBox.enterBoard(destX, destY, delayFactor);
}
}
}
+ return delayCounter;
}
-paintLevel(currentLevel);
+var initDelay = paintLevel(currentLevel);
if (!storage.instructionsShown) {
storage.instructionsShown = true;
showInstructions();
}
@@ -841,9 +1027,9 @@
dy = _directions$_i[1];
var newX = x + dx;
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) {
+ if (newX >= 0 && newX < currentLevel.d.length && newY >= 0 && newY < currentLevel.d[0].length) {
var colorBox = levelContainer.children.find(function (child) {
//return child.gridX === newX && child.gridY === newY;
return !child.outlier && child.gridX === newX && child.gridY === newY;
});
@@ -864,15 +1050,15 @@
//t[i].destroy();
t[i].remove(i * 30);
}
}
-function placeOutliers() {
+function placeOutliers(delayBy) {
// Determine colors left on the board to choose from.
var colorsPresent = [];
- var gridSize = currentLevel.length;
+ var gridSize = currentLevel.d.length;
for (var i = 0; i < gridSize; i++) {
for (var j = 0; j < gridSize; j++) {
- var t = currentLevel[i][j];
+ var t = currentLevel.d[i][j];
if (t != 0 && !colorsPresent.includes(t)) {
colorsPresent.push(t);
}
}
@@ -881,16 +1067,16 @@
// Determine what rows and cols contain colorboxes.
// Horizontal rows
var availableRows = [];
for (var i = 0; i < gridSize; i++) {
- if (currentLevel[i].some(checkNonZero)) {
+ if (currentLevel.d[i].some(checkNonZero)) {
//console.log('there are non-zero values in row:', i);
availableRows.push(i);
}
}
// Vertical columns
var availableCols = [];
- var cols = rotateMatrix90C(currentLevel);
+ var cols = rotateMatrix90C(currentLevel.d);
for (var i = 0; i < gridSize; i++) {
if (cols[i].some(checkNonZero)) {
//console.log('there are non-zero values in col:', i);
availableCols.push(i);
@@ -899,9 +1085,9 @@
// If no available rows or cols left, level cleared!
var n = availableRows.length + availableCols.length;
//console.log(n);
if (n === 0) {
- console.log('level cleared!');
+ //console.log('level cleared!');
return false;
} else {
var startX = -boardSize / 2;
var startY = -boardSize / 2;
@@ -939,9 +1125,9 @@
b.y = offset + startY + availableRows[i] * (boxSize + boxSpacing);
b.gridX = 99;
b.gridY = availableRows[i];
}
- b.fadeIn();
+ b.fadeIn(delayBy);
//console.log('b is:', b);
levelContainer.addChild(b);
//console.log('levelContainer is now:', levelContainer);
placedAtLeastOne = true;
@@ -970,9 +1156,9 @@
b.y = 900;
b.gridX = availableCols[i];
b.gridY = 99;
}
- b.fadeIn();
+ b.fadeIn(delayBy);
//console.log('b is:', b);
levelContainer.addChild(b);
//console.log('levelContainer is now:', levelContainer);
placedAtLeastOne = true;
@@ -1014,9 +1200,9 @@
}
// return the destination matrix
return destination;
}
-placeOutliers();
+placeOutliers(initDelay);
updateScoreLabels();
function moveIn() {
// Move all outliers onto stage
var outliers = levelContainer.children.filter(function (child) {
@@ -1031,27 +1217,27 @@
// Determine direction the outlier is moving in, in order to determine position to tween to.
if (t.gridX == -1) {
for (var j = gridSize - 1; j >= 0; j--) {
//console.log('j entry is', currentLevel[t.gridY][j]);
- if (currentLevel[t.gridY][j] != 0) {
+ if (currentLevel.d[t.gridY][j] != 0) {
newPos = j - 1;
}
}
//console.log(t, 'would move to position', newPos);
t.gridX = newPos;
} else if (t.gridX == 99) {
for (var j = 0; j < gridSize; j++) {
//console.log('j entry is', currentLevel[t.gridY][j]);
- if (currentLevel[t.gridY][j] != 0) {
+ if (currentLevel.d[t.gridY][j] != 0) {
newPos = j + 1;
}
}
//console.log(t, 'would move to position', newPos);
t.gridX = newPos;
} else if (t.gridY == -1) {
for (var j = gridSize - 1; j >= 0; j--) {
//console.log('j entry is', currentLevel[j][t.gridX]);
- if (currentLevel[j][t.gridX] != 0) {
+ if (currentLevel.d[j][t.gridX] != 0) {
newPos = j - 1;
}
}
//console.log(t, 'would move to position', newPos);
@@ -1059,9 +1245,9 @@
} else if (t.gridY == 99) {
// do something, fix this
for (var j = 0; j < gridSize; j++) {
//console.log('j entry is', currentLevel[j][t.gridX]);
- if (currentLevel[j][t.gridX] != 0) {
+ if (currentLevel.d[j][t.gridX] != 0) {
newPos = j + 1;
}
}
t.gridY = newPos;
@@ -1181,9 +1367,9 @@
currentLevel = levels[currentLevelID].map(function (arr) {
return arr.slice();
});
console.log('new level is', currentLevel);
- gridSize = currentLevel.length;
+ gridSize = currentLevel.d.length;
tileSize = calculateTileSize();
board.destroy();
board = new Board();
board.x = 1024;
@@ -1194,11 +1380,11 @@
levelContainer.x = 1024;
levelContainer.y = boardCenterY; //2732 / 2;
game.addChild(levelContainer);
//levelContainer = new Container();
- paintLevel(currentLevel);
+ var entranceDelay = paintLevel(currentLevel);
levelLabel.setText('Level ' + (currentLevelID + 1));
- placeOutliers();
+ placeOutliers(entranceDelay);
GAME_STATE = -1;
}
} else {
//TODO: Show game over - all levels completed!
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.