Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'instructionsScreen.scale is not a function' in or related to this line: 'if (Math.random() < 0.12) {' Line Number: 429
User prompt
Please fix the bug: 'instructionsScreen.scale is not a function' in or related to this line: 'instructionsScreen.scale(1.2, 1.2);' Line Number: 1033
Code edit (14 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Unable to load plugin: @upit/tween.v1' in or related to this line: 'var tween = LK.import("@upit/tween.v1");' Line Number: 32 ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1, @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please creata container class for the closebutton asset and add one to the helpscreen, in the top right corner
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
===================================================================
--- original.js
+++ change.js
@@ -115,9 +115,9 @@
}
};
self.mouseover = function () {
if (!self.outlier) {
- self.width = self.height = tileSize * 1.1;
+ self.width = self.height = tileSize * 1.05;
}
};
self.mouseout = function () {
if (!self.outlier) {
@@ -139,9 +139,10 @@
onFinish: function onFinish() {
//console.log("Animation complete!");
//console.log('currentLevel:', currentLevel);
//console.log('levelContainer:', levelContainer);
- playerScore++;
+ //playerScore++;
+ playerScore += latestRemoveCount;
var t = new Star(levelContainer.x + self.x, levelContainer.y + self.y, 1900, 50, 0, colors[self.colorIndex]);
//console.log('startx and y:', t.x, t.y);
game.addChild(t);
stars.push(t);
@@ -212,12 +213,28 @@
});
}
});
};
+ self.enterBoard = function (destX, destY, delayFactor) {
+ numRunningTweens++;
+ tween(self, {
+ x: destX,
+ y: destY
+ }, {
+ duration: BASE_TWEEN_SPEED,
+ delay: delayFactor,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ numRunningTweens--;
+ //currentLevel[self.gridY][self.gridX] = self.colorIndex;
+ //self.outlier = false;
+ }
+ });
+ };
self.moveInPosition = function () {
var startX = -boardSize / 2;
var startY = -boardSize / 2;
- var boxSize = tileSize; //calculateTileSize();
+ var boxSize = tileSize;
var boxSpacing = boxSize * spacingRatio;
var offset = boxSize / 2 + boxSpacing;
var destX = offset + startX + self.gridX * (boxSize + boxSpacing);
var destY = offset + startY + self.gridY * (boxSize + boxSpacing);
@@ -354,35 +371,46 @@
var Star = Container.expand(function (startX, startY, endX, endY, delay, boxTint) {
var self = Container.call(this);
//GoldCoin.delayIncrement = 0;
//self.game = this;
- var starGraphics = self.attachAsset('star', {
+ /*var starGraphics = self.attachAsset('star', {
anchorX: 0.5,
anchorY: 0.5,
tint: boxTint
});
self.addChild(starGraphics);
+ */
+ var plusLabel = new Text2('+' + latestRemoveCount, {
+ size: 120,
+ fill: 0xFFFFFF,
+ align: 'center',
+ font: 'Georgia'
+ });
+ plusLabel.anchor.set(0.5, 0.5); // Anchor to the right
+ plusLabel.x = 0;
+ plusLabel.y = 0;
+ self.addChild(plusLabel);
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;
+ var duration = 40 + delay; //30 + delay;
self.alpha = 0;
//self.path = createQuadraticBezierArcPoints(startX, startY, endX, startY - 100, endX, endY, 60);
- self.path = createQuadraticBezierArcPoints(startX, startY, endX, startY + 200, endX, endY, 30);
+ //self.path = createQuadraticBezierArcPoints(startX, startY, endX, startY + 200, endX, endY, 30);
self._move_migrated = function () {
if (self.delayCounter > 0) {
self.delayCounter--;
} else {
self.alpha = 1;
+ self.y -= 4;
+ /*
self.rotation += 0.11;
if (self.path[duration]) {
- self.x = self.path[duration - self.delayCounter][0];
- self.y = self.path[duration - self.delayCounter][1];
- }
+ self.x = self.path[duration - self.delayCounter][0];
+ self.y = self.path[duration - self.delayCounter][1];
+ }*/
}
if (--duration <= 0) {
self.destroy();
self.isDead = true;
@@ -399,15 +427,17 @@
/****
* Game Code
****/
+//LK.init.music('backgroundMusic')
+//LK.init.sound('testmusic', {volume:1, start:0, end:0.995, id:'676c4b01fd1ad619bb4ea263'})
var lerp = function lerp(start, end, t) {
return start * (1 - t) + end * t;
};
// Play test music in a loop
-LK.playMusic('testmusic', {
+/*LK.playMusic('testmusic', {
loop: true
-});
+});*/
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];
});
@@ -563,9 +593,9 @@
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 300,
- tint: 0x22ddff
+ tint: 0x55eeff
});
game.addChild(gameLogo);
var helpButton = new HelpButton();
helpButton.x = 2048 - 150;
@@ -695,8 +725,9 @@
var currentLevel = levels[currentLevelID].map(function (arr) {
return Array.isArray(arr) ? arr.slice() : [];
});
var stars = [];
+var latestRemoveCount = 0;
var levelContainer = new Container();
levelContainer.x = 1024;
levelContainer.y = boardCenterY; //2732 / 2 + 200;
game.addChild(levelContainer);
@@ -723,12 +754,18 @@
for (var j = 0; j < a[0].length; j++) {
if (a[j][i] != 0) {
var cBox = levelContainer.addChild(new ColorBox(a[j][i]));
cBox.width = cBox.height = boxSize;
- cBox.x = offset + startX + i * (boxSize + boxSpacing);
- cBox.y = offset + startY + j * (boxSize + boxSpacing);
+ //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;
+ cBox.enterBoard(destX, destY, delayFactor);
}
}
}
}
@@ -821,8 +858,9 @@
console.log('colorbox clicked:', b);
// Find connected tiles with same color
var t = findConnectedSameColorTiles(b);
//console.log(t);
+ latestRemoveCount = t.length;
for (var i = 0; i < t.length; i++) {
//t[i].destroy();
t[i].remove(i * 30);
}
@@ -999,9 +1037,8 @@
}
}
//console.log(t, 'would move to position', newPos);
t.gridX = newPos;
- //t.moveInPosition();
} 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) {
@@ -1009,9 +1046,8 @@
}
}
//console.log(t, 'would move to position', newPos);
t.gridX = newPos;
- //t.moveInPosition();
} 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) {
@@ -1019,9 +1055,8 @@
}
}
//console.log(t, 'would move to position', newPos);
t.gridY = newPos;
- //t.moveInPosition();
} 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]);
@@ -1029,11 +1064,10 @@
newPos = j + 1;
}
}
t.gridY = newPos;
- //t.moveInPosition();
}
- console.log(t, 'would move to position', newPos);
+ //console.log(t, 'would move to position', newPos);
if (newPos == -1 || newPos == gridSize) {
// Game Over, lost
var highScore = storage.highScore || 0;
if (playerScore > highScore) {
@@ -1042,9 +1076,9 @@
//console.log('highscore is now:', storage.highScore);
t.tint = 0xFF0000;
isGameOver = true;
t.blinkRed();
- /*
+ /*
tween(t, {
width: tileSize * 1.5,
height: tileSize * 1.5
}, {
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.