Code edit (21 edits merged)
Please save this source code
User prompt
where it says 'make the t objects flash red' in the code, please make it do so
Code edit (1 edits merged)
Please save this source code
User prompt
please place a score label above the boad on the right side, and under it, a highest score label,somewhat smaller
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: Invalid end type for property x: undefined' in or related to this line: 'tween(self, {' Line Number: 173
Code edit (7 edits merged)
Please save this source code
User prompt
on gameover, please compare the playerscore to any previously stored highscore, using the storage plugin, and store the new highscore if it is indeed higher than the previous score. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'setItem')' in or related to this line: 'localStorage.setItem('highscore', playerScore);' Line Number: 679
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'setItem')' in or related to this line: 'localStorage.setItem('highscore', playerScore);' Line Number: 675
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'setItem')' in or related to this line: 'localStorage.setItem('highscore', playerScore);' Line Number: 671
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: 'TypeError: Cannot set properties of undefined (setting '3')' in or related to this line: 'currentLevel[self.gridY][self.gridX] = self.colorIndex;' Line Number: 189
Code edit (1 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: 'for (var i = 0; i < a.length; i++) {' Line Number: 357
Code edit (1 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: 'for (var i = 0; i < a.length; i++) {' Line Number: 357
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < a.length; i++) {' Line Number: 357
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: 'TypeError: Cannot set properties of undefined (setting '5')' in or related to this line: 'currentLevel[self.gridY][self.gridX] = self.colorIndex;' Line Number: 189
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'newPosition is not defined' in or related to this line: 'if (newPosition != 999) {' Line Number: 638
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -125,8 +125,9 @@
//console.log("Animation complete!");
//console.log('currentLevel:', currentLevel);
//console.log('levelContainer:', levelContainer);
playerScore++;
+ updateScoreLabels();
numRunningTweens--;
self.destroy();
}
});
@@ -202,9 +203,9 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000022
});
/****
* Game Code
@@ -327,26 +328,41 @@
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;
+var highScore = storage.highScore || 0;
// Create and position the score label
-var scoreLabel = new Text2('Score:', {
- size: 100,
- fill: 0xFFFFFF
+var scoreLabel = new Text2('Score\n0', {
+ size: 60,
+ fill: 0xFFFFFF,
+ align: 'center'
});
scoreLabel.anchor.set(1, 0); // Anchor to the right
scoreLabel.x = 2048 - 50; // Position near the right edge
scoreLabel.y = 50; // Position at the top
-LK.gui.topRight.addChild(scoreLabel);
+//LK.gui.topRight.addChild(scoreLabel);
+game.addChild(scoreLabel);
// Create and position the high score label
-var highScoreLabel = new Text2('High Score:', {
- size: 80,
- fill: 0xdddddd
+var highScoreLabel = new Text2('Best\n0', {
+ size: 50,
+ fill: 0xdddddd,
+ align: 'center'
});
highScoreLabel.anchor.set(1, 0); // Anchor to the right
-highScoreLabel.x = 2048 - 50; // Position near the right edge
-highScoreLabel.y = 150; // Position below the score label
-LK.gui.topRight.addChild(highScoreLabel);
+highScoreLabel.x = 2048 - 75; // Position near the right edge
+highScoreLabel.y = 220; // Position below the score label
+//LK.gui.topRight.addChild(highScoreLabel);
+game.addChild(highScoreLabel);
+var levelLabel = new Text2('Level 1', {
+ size: 120,
+ fill: 0xFFFFFF,
+ align: 'center'
+});
+levelLabel.anchor.set(0.5, 0.5);
+levelLabel.x = 1024; // Position near the right edge
+levelLabel.y = 100; // Position at the top
+//LK.gui.topRight.addChild(scoreLabel);
+game.addChild(levelLabel);
var colors = ['0x000000', '0xffffff', '0xffff00', '0xff0000', '0x000055', '0x00ff00', '0xff00ff'];
var gridSize = 5;
var spacingRatio = 0.2;
var boardSize = 1300;
@@ -622,8 +638,9 @@
// return the destination matrix
return destination;
}
placeOutliers();
+updateScoreLabels();
function moveIn() {
// Move all outliers onto stage
var outliers = levelContainer.children.filter(function (child) {
return child.outlier;
@@ -682,8 +699,22 @@
if (playerScore > highScore) {
storage.highScore = playerScore;
}
console.log('highscore is now:', storage.highScore);
+ tween(t, {
+ tint: 0xFF0000
+ }, {
+ duration: 500,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(t, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 500,
+ easing: tween.easeInOut
+ });
+ }
+ });
LK.setScore(playerScore);
LK.showGameOver();
} else if (newPos != 999) {
t.moveInPosition();
@@ -691,8 +722,15 @@
t.flyOut();
}
}
}
+function updateScoreLabels() {
+ scoreLabel.setText('Score\n' + playerScore);
+ if (playerScore > highScore) {
+ highScore = playerScore;
+ }
+ highScoreLabel.setText('Best\n' + highScore);
+}
//moveIn();
var GAME_STATE = -1;
// -1: INIT
// 0: Waiting for input
@@ -751,8 +789,9 @@
levelContainer.y = 2732 / 2;
game.addChild(levelContainer);
//levelContainer = new Container();
paintLevel(currentLevel);
+ levelLabel.setText('Level ' + (currentLevelID + 1));
placeOutliers();
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.