User prompt
add a 0 infront of every timer thats lower than 10 so 0 is 00 and 9 is 09
Code edit (5 edits merged)
Please save this source code
User prompt
add a 0 infront of every score thats lower than 10 so 0 is 00 and 9 is 09
Code edit (1 edits merged)
Please save this source code
User prompt
the location of scoretxt should be determend by coordinates
===================================================================
--- original.js
+++ change.js
@@ -71,9 +71,9 @@
self.update = function (timeLeft) {
if (isNaN(timeLeft)) {
self.timerText.setText('30');
} else {
- self.timerText.setText(timeLeft.toString());
+ self.timerText.setText(timeLeft < 10 ? '0' + timeLeft.toString() : timeLeft.toString());
}
};
});
@@ -104,9 +104,9 @@
var scoreTxt = new Text2('0', {
size: 180,
fill: "#ffffff"
});
-scoreTxt.x = 2048 / 2 - 50; // Center the score text horizontally
+scoreTxt.x = 2048 / 2 - 75; // Center the score text horizontally
scoreTxt.y = 0; // Position the score text 100 pixels from the top
game.addChild(scoreTxt); // Add score display to the game
// Function to spawn targets
function startGame() {