User prompt
remove highscore
User prompt
remove it
User prompt
remove it and make the score bigger
User prompt
change highscoce to highscore and visible
User prompt
when the timer is 15 seconds or lower, change color to red
User prompt
font to Bahnschrift
User prompt
change to times new roman and make bigger with bold
User prompt
convert to mins and secs
===================================================================
--- original.js
+++ change.js
@@ -38,18 +38,18 @@
fontWeight: 'bold'
});
scoreTxt.anchor.set(0.5, 1);
LK.gui.bottom.addChild(scoreTxt);
-var highScoreTxt = new Text2('Highscore: 0', {
- size: 100,
+// Create the timer text and position it above the high score text
+var timerTxt = new Text2('Time: 0', {
+ size: 300,
fill: "#ffffff",
- font: "'.VnAvant', serif",
+ font: "'Bahnschrift', serif",
fontWeight: 'bold'
});
-highScoreTxt.anchor.set(0.5, 1);
-LK.gui.bottom.addChild(highScoreTxt);
-highScoreTxt.y = scoreTxt.y - scoreTxt.height;
-highScoreTxt.visible = true;
+timerTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(timerTxt);
+timerTxt.y = 0;
// Create the button and position it at the center of the screen
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0
@@ -82,5 +82,15 @@
} else {
// End the game when the timer reaches 0
LK.showGameOver();
}
+ // Update the timer text
+ var minutes = Math.floor(timer / 3600);
+ var seconds = Math.floor(timer % 3600 / 60);
+ timerTxt.setText(minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
+ // Change the color of the timer text to red when the timer is 15 seconds or lower
+ if (minutes == 0 && seconds <= 15) {
+ timerTxt.fill = "#ff0000";
+ } else {
+ timerTxt.fill = "#ffffff";
+ }
};
\ No newline at end of file