Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'tileTypes is not defined' in or related to this line: 'var boxGraphics = self.attachAsset(tileTypes[colorIndex], {' Line Number: 124
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'star is not defined' in or related to this line: 'stars.push(star);' Line Number: 260
Code edit (22 edits merged)
Please save this source code
User prompt
Please make the levelcomplete screen contain and display a fireworks explosion when it opens
Code edit (1 edits merged)
Please save this source code
User prompt
please place an instance of the gamelogo center screen top
Code edit (3 edits merged)
Please save this source code
User prompt
please loop the testmusic instead of the background music
User prompt
make a background music asset to be looped continously
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'map')' in or related to this line: 'currentLevel = levels[currentLevelID].map(function (arr) {' Line Number: 960
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'map')' in or related to this line: 'currentLevel = levels[currentLevelID].map(function (arr) {' Line Number: 960
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'var n = source[0].length;' Line Number: 793
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: 'ReferenceError: ty is not defined' in or related to this line: 'console.log('startx and y:', t.x, ty);' Line Number: 139
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
please use the backgrounfimage asset as a background by adding it just before the scorelabel is added
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: arr.slice is not a function' in or related to this line: 'return arr.slice();' Line Number: 858
===================================================================
--- original.js
+++ change.js
@@ -11,9 +11,9 @@
var self = Container.call(this);
var arrowGraphics = self.attachAsset('arrow', {
anchorX: 0.5,
anchorY: 0.5,
- alpha: 0.5
+ alpha: 0.75
});
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
@@ -125,8 +125,12 @@
//console.log("Animation complete!");
//console.log('currentLevel:', currentLevel);
//console.log('levelContainer:', levelContainer);
playerScore++;
+ var t = new Star(levelContainer.x + self.x, levelContainer.y + self.y, 1900, 100, 0);
+ console.log('startx and y:', t.x, ty);
+ game.addChild(t);
+ stars.push(t);
updateScoreLabels();
numRunningTweens--;
self.destroy();
}
@@ -218,8 +222,45 @@
}
});
};
});
+var Star = Container.expand(function (startX, startY, endX, endY, delay) {
+ var self = Container.call(this);
+ //GoldCoin.delayIncrement = 0;
+ //self.game = this;
+ var starGraphics = self.attachAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.addChild(starGraphics);
+ self.x = startX;
+ self.y = startY;
+ self.isDead = false;
+ var distance = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
+ self.delayCounter = delay * 2;
+ var duration = 30 + delay;
+ var vx = (endX - startX) / duration;
+ var vy = (endY - startY) / duration;
+ self.alpha = 0;
+ self.path = createQuadraticBezierArcPoints(startX, startY, endX, startY - 100, endX, endY, 60);
+ self._move_migrated = function () {
+ if (self.delayCounter > 0) {
+ self.delayCounter--;
+ } else {
+ self.alpha = 1;
+ //self.rotation += 0.01;
+ if (self.path[duration]) {
+ self.x = self.path[duration - self.delayCounter][0];
+ self.y = self.path[duration - self.delayCounter][1];
+ }
+ }
+ if (--duration <= 0) {
+ self.destroy();
+ return;
+ self.isDead = true;
+ }
+ };
+});
/****
* Initialize Game
****/
@@ -229,8 +270,33 @@
/****
* Game Code
****/
+var lerp = function lerp(start, end, t) {
+ return start * (1 - t) + end * t;
+};
+var createQuadraticBezierArcPoints = function createQuadraticBezierArcPoints(p0x, p0y, p1x, p1y, p2x, p2y, numberOfSteps) {
+ var points_along_axis = new Array(numberOfSteps).fill(null).map(function () {
+ return [0, 0];
+ });
+ var stepping_constant = 1 / numberOfSteps;
+ for (var i = 0; i < numberOfSteps; i++) {
+ var i_p0_p1x = lerp(p0x, p1x, i * stepping_constant);
+ var i_p0_p1y = lerp(p0y, p1y, i * stepping_constant);
+ var i_p1_p2x = lerp(p1x, p2x, i * stepping_constant);
+ var i_p1_p2y = lerp(p1y, p2y, i * stepping_constant);
+ if (false) {
+ points_along_axis.push(lerp(i_p0_p1x, i_p1_p2x, i * stepping_constant), lerp(i_p0_p1y, i_p1_p2y, i * stepping_constant));
+ }
+ points_along_axis[i][0] = lerp(i_p0_p1x, i_p1_p2x, i * stepping_constant);
+ points_along_axis[i][1] = lerp(i_p0_p1y, i_p1_p2y, i * stepping_constant);
+ }
+ if (false) {
+ console.log('path: ' + points_along_axis);
+ console.log('path[2]: ' + points_along_axis[2]);
+ }
+ return points_along_axis.reverse();
+};
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
function _nonIterableRest() {
@@ -353,8 +419,9 @@
// Add background image
var backgroundImage = LK.getAsset('backgroundImage', {
anchorX: 0.5,
anchorY: 0.5,
+ alpha: 0.7,
x: 1024,
y: 1366
});
game.addChild(backgroundImage);
@@ -390,9 +457,9 @@
levelLabel.y = 100; // Position at the top
//LK.gui.topRight.addChild(scoreLabel);
game.addChild(levelLabel);
var gridSize = 5;
-var spacingRatio = 0.2;
+var spacingRatio = 0.2; //0.2;
var boardSize = 1300;
function calculateTileSize() {
// Example of getting desired tileSize depending on gridSize (for different size grids)
// maintaining 1300px board size and 0.2 gutter between tiles.
@@ -435,9 +502,9 @@
//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 = [[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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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]];
var l6c = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 5, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 6, 6, 0, 0, 0], [0, 0, 0, 1, 2, 2, 6, 6, 3, 0], [0, 4, 0, 0, 2, 2, 5, 0, 3, 0], [0, 4, 0, 0, 3, 5, 5, 0, 3, 0], [0, 4, 4, 3, 3, 3, 5, 0, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
-var l6d = [];
+var l6d = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 8, 8, 8, 8, 0, 0, 0], [0, 0, 8, 2, 2, 2, 2, 8, 0, 0], [0, 8, 2, 2, 4, 2, 0, 0, 0, 0], [0, 8, 2, 2, 2, 0, 0, 0, 0, 0], [0, 8, 2, 2, 2, 2, 2, 2, 8, 0], [0, 0, 8, 2, 2, 2, 2, 8, 0, 0], [0, 0, 0, 8, 8, 8, 8, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
var l6e = [];
var l6f = [];
var l6g = [];
// Levels ordered by grid size, for shuffling while maintining difficulty ramping.
@@ -464,14 +531,15 @@
var levels9 = [l5a, l5b, l5c, l5d, l5e, l5f, l5g];
var levels10 = [l6a, l6b, l6c, l6d, l6e, l6f, l6g];
// All levels in one array.
//var levels = levels5.concat(levels6, levels7, levels8, levels9, levels10);
-var levels = [l1a, l6c, l1b, l1c, l1d, l1e, l1f, l1g, l2a, l2b, l2c, l2d, l2e, l2f, l2g, l3a, l4a, l5a];
+var levels = [l1a, l4d, 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 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() : [];
});
+var stars = [];
var levelContainer = new Container();
levelContainer.x = 1024;
levelContainer.y = 2732 / 2;
game.addChild(levelContainer);
@@ -897,5 +965,13 @@
LK.setTimeout(function () {
LK.showGameOver();
}, 1300);
}
+ for (var l = stars.length - 1; l >= 0; l--) {
+ if (stars[l].isDead) {
+ stars[l].destroy();
+ stars.splice(l, 1);
+ } else {
+ stars[l]._move_migrated();
+ }
+ }
};
\ No newline at end of file
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.