Code edit (4 edits merged)
Please save this source code
Code edit (19 edits merged)
Please save this source code
User prompt
Please fix the bug: 'l6i is not defined' in or related to this line: 'var levels10 = [l6a, l6b, l6c, l6d, l6e, l6f, l6g, l6h, l6i];' Line Number: 1252
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -333,9 +333,9 @@
} else {
s += "You've discovered all " + levelsTotal + " levels\n\nPlay again to beat your best score.";
}
var label = new Text2(s, {
- size: 100,
+ size: 75,
fill: 0xdddddd,
align: 'center',
font: 'Georgia'
});
@@ -667,10 +667,10 @@
/****
* Game Code
****/
-//LK.init.music('backgroundMusic')
//LK.init.sound('testmusic', {volume:1, start:0, end:0.995, id:'676c4b01fd1ad619bb4ea263'})
+//LK.init.music('backgroundMusic')
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
@@ -830,8 +830,12 @@
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; //0; // increment to allow outliers spawning on different side each turn.
var playerScore = 0;
+// TODO: Uncomment to reset storage variable
+//storage.highScore = 0;
+//storage.levelsDiscovered = [];
+// END optional uncomment
var highScore = storage.highScore || 0;
storage.levelsDiscovered = storage.levelsDiscovered || []; // Initialize levelsDiscovered as an array if not already defined
// Add background image
var backgroundImage = LK.getAsset('backgroundImage', {
@@ -915,9 +919,9 @@
// Example of getting desired tileSize depending on gridSize (for different size grids)
// maintaining 1300px board size and 0.2 gutter between tiles.
var tileSize = boardSize / ((gridSize + 1) * spacingRatio + gridSize);
return tileSize;
- console.log(tileSize);
+ //console.log(tileSize);
}
var tileSize = calculateTileSize();
var particleContainer = new ParticleContainer();
game.addChild(particleContainer);
@@ -964,8 +968,18 @@
name: "Santa's Topper",
uid: 107,
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]]
};
+var l1h = {
+ name: "The Stacked Bite",
+ uid: 108,
+ d: [[0, 0, 0, 0, 0], [0, 8, 8, 8, 0], [0, 2, 2, 2, 0], [0, 8, 8, 8, 0], [0, 0, 0, 0, 0]]
+};
+var l1i = {
+ name: "Flame Carrier",
+ uid: 109,
+ d: [[0, 0, 0, 0, 0], [0, 0, 3, 0, 0], [0, 3, 2, 3, 0], [0, 0, 8, 0, 0], [0, 0, 8, 0, 0]]
+};
// 6x6 levels
var l2a = {
name: 'Duck Dive',
uid: 201,
@@ -1000,8 +1014,18 @@
name: 'Monkey Business',
uid: 207,
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]]
};
+var l2h = {
+ name: 'Steak Boy',
+ uid: 208,
+ d: [[0, 0, 0, 0, 0, 0], [0, 4, 3, 3, 4, 0], [0, 3, 1, 1, 3, 0], [0, 3, 3, 3, 3, 0], [0, 3, 0, 0, 3, 0], [0, 0, 0, 0, 0, 0]]
+};
+var l2i = {
+ name: 'Dimensional Leap',
+ uid: 209,
+ d: [[0, 0, 0, 0, 0, 0], [0, 0, 2, 2, 0, 0], [0, 2, 4, 7, 2, 0], [0, 2, 8, 8, 2, 0], [0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0]]
+};
// 7x7 levels
var l3a = {
name: "Rudolph's Glow",
uid: 301,
@@ -1036,8 +1060,18 @@
name: 'The Apple Orchard',
uid: 307,
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]]
};
+var l3h = {
+ name: 'The Grid Riddle',
+ uid: 308,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 0, 7, 0, 0], [0, 2, 2, 7, 5, 7, 0], [0, 0, 7, 0, 2, 0, 0], [0, 7, 5, 2, 5, 7, 0], [0, 0, 5, 0, 5, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
+};
+var l3i = {
+ name: 'Honey Chase',
+ uid: 309,
+ d: [[0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 8, 4, 0], [0, 2, 8, 2, 8, 2, 0], [0, 0, 8, 2, 8, 0, 0], [0, 0, 0, 0, 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, 1, 1, 0, 0, 0, 0], [0, 0, 2, 2, 0, 0, 0, 0], [0, 2, 2, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
var l4a = {
name: 'UFO Spotting',
@@ -1073,8 +1107,18 @@
name: 'Home Sweet Home',
uid: 407,
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, 4, 6, 6, 4, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
};
+var l4h = {
+ name: 'The Lander',
+ uid: 408,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 7, 7, 0, 0, 0], [0, 0, 7, 4, 4, 7, 0, 0], [0, 0, 7, 7, 7, 7, 0, 0], [0, 0, 7, 7, 7, 7, 0, 0], [0, 7, 0, 2, 2, 0, 7, 0], [0, 3, 0, 0, 0, 0, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l4i = {
+ name: 'Crimson Gem',
+ uid: 409,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 3, 1, 9, 3, 0, 0], [0, 3, 1, 9, 1, 9, 3, 0], [0, 3, 9, 1, 9, 6, 3, 0], [0, 0, 3, 9, 6, 3, 0, 0], [0, 0, 0, 3, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
+};
// 9x9 levels
var l5a = {
name: 'Bag of Tricks',
uid: 501,
@@ -1109,8 +1153,18 @@
name: "Cheshire Cat",
uid: 507,
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]]
};
+var l5h = {
+ name: "Ice Slider",
+ uid: 508,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 7, 4, 0, 0, 0], [0, 0, 0, 7, 2, 7, 0, 0, 0], [0, 0, 0, 7, 1, 7, 0, 0, 0], [0, 0, 7, 1, 1, 1, 7, 0, 0], [0, 0, 7, 1, 1, 1, 7, 0, 0], [0, 0, 7, 1, 1, 1, 7, 0, 0], [0, 0, 2, 2, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l5i = {
+ name: "Emperor Crab",
+ uid: 509,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 3, 0, 3, 0, 3, 0], [0, 3, 3, 8, 0, 8, 3, 3, 0], [0, 0, 3, 0, 0, 0, 3, 0, 0], [0, 0, 8, 1, 3, 1, 8, 0, 0], [0, 0, 0, 3, 3, 3, 0, 0, 0], [0, 3, 3, 8, 3, 8, 3, 3, 0], [0, 0, 3, 0, 0, 0, 3, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
// 10x10 levels
var l6a = {
name: 'Orb of Wisdom',
uid: 601,
@@ -1118,9 +1172,9 @@
};
var l6b = {
name: "Donald's Quack",
uid: 602,
- d: [[0, 0, 4, 4, 4, 4, 4, 4, 0, 0], [0, 4, 4, 4, 4, 4, 4, 4, 4, 0], [0, 0, 8, 8, 8, 8, 8, 8, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 4, 1, 1, 4, 1, 1, 0], [0, 2, 2, 2, 2, 2, 2, 2, 2, 0], [0, 0, 0, 4, 3, 3, 4, 0, 0, 0], [0, 0, 0, 4, 4, 4, 4, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 2, 0, 0, 2, 0, 0, 0]]
+ d: [[0, 0, 4, 4, 4, 4, 4, 4, 0, 0], [0, 4, 4, 4, 4, 4, 4, 4, 4, 0], [0, 0, 8, 8, 8, 8, 8, 8, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 4, 1, 1, 4, 1, 1, 0], [0, 2, 2, 2, 2, 2, 2, 2, 2, 0], [0, 0, 0, 4, 3, 3, 4, 0, 0, 0], [0, 0, 0, 4, 4, 4, 4, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 1, 0, 0, 0]]
};
var l6c = {
name: 'Block Party',
uid: 603,
@@ -1145,24 +1199,39 @@
name: "Serpent's Trail",
uid: 607,
d: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 5, 0, 5, 0, 0, 0, 0, 0], [0, 5, 2, 5, 2, 5, 0, 0, 0, 0], [0, 5, 5, 5, 5, 5, 0, 0, 5, 0], [0, 0, 1, 0, 1, 0, 0, 5, 0, 0], [0, 0, 0, 5, 0, 0, 0, 5, 0, 0], [0, 0, 4, 5, 5, 5, 5, 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]]
};
+var l6h = {
+ name: "Zak's Dream",
+ uid: 608,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 4, 4, 0, 0, 4, 4, 0, 0], [0, 4, 4, 4, 4, 4, 4, 4, 4, 0], [0, 4, 5, 5, 4, 4, 5, 5, 4, 0], [0, 4, 1, 1, 4, 4, 1, 1, 4, 0], [0, 0, 4, 4, 9, 9, 4, 4, 0, 0], [0, 0, 0, 9, 9, 9, 9, 0, 0, 0], [0, 0, 4, 4, 9, 9, 4, 4, 0, 0], [0, 4, 4, 0, 4, 4, 0, 4, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var l6g = {
+ name: "Another Castle",
+ uid: 609,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 8, 0, 8, 0, 0], [0, 0, 0, 0, 2, 2, 2, 2, 0, 0], [0, 0, 0, 2, 2, 2, 4, 1, 2, 0], [0, 0, 0, 2, 2, 1, 1, 1, 0, 0], [0, 0, 2, 2, 9, 1, 9, 0, 0, 0], [0, 0, 0, 1, 9, 9, 9, 1, 0, 0], [0, 0, 0, 0, 9, 9, 9, 0, 0, 0], [0, 0, 0, 9, 3, 9, 3, 9, 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];
-var levels8 = [l4a, l4b, l4c, l4d, l4e, l4f, l4g];
-var levels9 = [l5a, l5b, l5c, l5d, l5e, l5f, l5g];
-var levels10 = [l6a, l6b, l6c, l6d, l6e, l6f, l6g];
+var levels5 = [l1a, l1b, l1c, l1d, l1e, l1f, l1g, l1h, l1i];
+var levels6 = [l2a, l2b, l2c, l2d, l2e, l2f, l2g, l2h, l2i];
+var levels7 = [l3a, l3b, l3c, l3d, l3e, l3f, l3g, l3h, l3i];
+var levels8 = [l4a, l4b, l4c, l4d, l4e, l4f, l4g, l4h, l4i];
+var levels9 = [l5a, l5b, l5c, l5d, l5e, l5f, l5g, l5h, l5i];
+var l6i = {
+ name: "Mystic Path",
+ uid: 610,
+ d: [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
+};
+var levels10 = [l6a, l6b, l6c, l6d, l6e, l6f, l6g, l6h, l6i];
// All levels in one array.
var levelsAll = levels5.concat(levels6, levels7, levels8, levels9, levels10);
//var levelAll = levelsAll; // Define levelAll as a reference to levelsAll
//var levelAll = levelsAll; // Define levelAll as a reference to levelsAll
//console.log(levelsAll);
//console.log(storage.levelsDiscovered);
//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 = [l1a, l4f, l5b, l5d, l5f, l5g, l6f];
-var levels = randomLevelSelection();
+var levels = [l1h, l6h, l6i, l4f, l5b, l5d, l5f, l5g, l6f];
+//var levels = randomLevelSelection();
var currentLevelID = 0;
// Copy without reference, so we have original for retry/level reset.
//var currentLevel = levels[currentLevelID].map(function (arr) {
// return Array.isArray(arr) ? arr.slice() : [];
@@ -1216,9 +1285,9 @@
//levelNameLabel.setText(a.name + ' ' + a.uid);
levelNameLabel.setText('"' + a.name + '"');
if (!storage.levelsDiscovered.includes(currentLevel.uid)) {
storage.levelsDiscovered.push(currentLevel.uid);
- console.log('uids:' + storage.levelsDiscovered);
+ //console.log('uids:' + storage.levelsDiscovered);
}
return delayCounter;
}
var initDelay = paintLevel(currentLevel);
@@ -1623,9 +1692,9 @@
} else if (GAME_STATE == 4) {
// go to next level or game completed.
// If we haven't run out of levels, fo to the next one.
//if (currentLevelID != levels.length - 1) {
- if (currentLevelID != levels.length - 1 || false) {
+ if (currentLevelID != levels.length - 1) {
if (showingLevelCompleteCounter == 0) {
showingLevelCompleteCounter++;
// show level complete screen.
levelCompleteScreen = new LevelComplete();
@@ -1642,9 +1711,9 @@
//currentLevel = levels[currentLevelID].map(function (arr) {
// return arr.slice();
//});
currentLevel = levels[currentLevelID];
- console.log('new level is', currentLevel);
+ //console.log('new level is', currentLevel);
gridSize = currentLevel.d.length;
tileSize = calculateTileSize();
board.destroy();
board = new Board();
@@ -1662,16 +1731,27 @@
placeOutliers(entranceDelay);
GAME_STATE = -1;
}
} else {
- //TODO: Show game over - all levels completed!
- var gcs = new GameComplete();
- gcs.x = 1024;
- gcs.y = boardCenterY;
- game.addChild(gcs);
- LK.setTimeout(function () {
- LK.showGameOver();
- }, 5000);
+ // Show game over - all levels completed!
+ if (showingLevelCompleteCounter == 0) {
+ showingLevelCompleteCounter++;
+ var gcs = new GameComplete();
+ gcs.x = 1024;
+ gcs.y = boardCenterY;
+ game.addChild(gcs);
+ } else if (showingLevelCompleteCounter < showingLevelCompleteCounterMax) {
+ showingLevelCompleteCounter++;
+ } else {
+ var highScore = storage.highScore || 0;
+ if (playerScore > highScore) {
+ storage.highScore = playerScore;
+ }
+ LK.setScore(playerScore);
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 2000);
+ }
}
} else if (GAME_STATE == 5) {
LK.setTimeout(function () {
LK.showGameOver();
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.