Code edit (14 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
use the lk storage plugin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'storage is not defined' in or related to this line: 'storage.bestScore = storage.bestScore || 0;' Line Number: 513
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -472,20 +472,8 @@
strokeThickness: 8
});
scoreLabel.anchor.set(0.5, 0); // Center the score label horizontally
LK.gui.top.addChild(scoreLabel);
-storage.bestScore = storage.bestScore || 0;
-var bestScoreLabel = new Text2('Best Score\n0', {
- size: 60,
- fill: 0xFFFFFF,
- stroke: 0x000000,
- strokeThickness: 8
-});
-bestScoreLabel.x = 2024 - 300;
-bestScoreLabel.y = 400;
-bestScoreLabel.setText('Best Score\n' + storage.bestScore);
-bestScoreLabel.anchor.set(0.5, 0);
-game.addChild(bestScoreLabel);
var gameStarted = false;
var gameOver = false;
var gamePaused = false;
var obstacles = [];
@@ -515,8 +503,22 @@
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
+storage.bestScore = storage.bestScore || 0;
+var bestScoreLabel = new Text2('Best Score\n0', {
+ size: 60,
+ fill: 0x2244ff,
+ stroke: 0x000000,
+ strokeThickness: 8,
+ align: 'center',
+ outline: 2
+});
+bestScoreLabel.x = 2024 - 350;
+bestScoreLabel.y = 450;
+bestScoreLabel.setText('Best Score\n' + storage.bestScore);
+//bestScoreLabel.anchor.set(0.5, 0);
+//game.addChild(bestScoreLabel);
// Add first path image
var path1 = LK.getAsset('path', {
anchorX: 0,
anchorY: 0,
@@ -615,8 +617,9 @@
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
cover.destroy();
+ game.addChild(bestScoreLabel);
logo.x = 1800;
logo.y = 250;
logo.width = 400;
logo.height = 400;
A background illstration for a game, rich in style, medieval fantasy themed, of a landscape seen from a great distance, like froma mountain ridge with mountains and forests and lakes and lots of features.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A spritesheet with various poses for a heavily armored little dwarven warrior with an axe in various poses for use in an endless runner game. Te poses should include walking, eating, jumping, ducking low, and chargingforward. Sprites should be laid out in a rectangular grid wih blank space between them. Style should be medieval fantasy.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A game logo for a game called 'Endless Viking Run' using norse font on a background of a viking shield and crossed axes. Muted colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.