User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'y')' in or related to this line: 'mode2Button.y = 2732 / 1.7;' Line Number: 94
User prompt
make the easy and nightmare mode more little bit near to normal mode
User prompt
make easy and nightmare more far from normal mode
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'mode1Button.y = (easyModeButton.y + mode2Button.y) / 2;' Line Number: 93
User prompt
make the normal mode button in the middle of easy mode and nightmare mode
User prompt
make the normal mode stands between easy mode and normal mode
User prompt
make the easy mode is more far from nightmare mode
User prompt
buat tombol mode mudah jadi lebih menjarak dari mode mimpi buruk
User prompt
Move the easy mode button to above the normal mode button
User prompt
Add easy mode
User prompt
make the NPCs walk from start
User prompt
hilangkan bulet
User prompt
make the time shows mm:ss everytime
User prompt
when the time show 06:00, end the game
User prompt
remove the time text
User prompt
make the time from time: 0 to 00:00
User prompt
make a timer, and show it when the game started
User prompt
make the clock appear when the game started
===================================================================
--- original.js
+++ change.js
@@ -243,18 +243,22 @@
var bullets = [];
var npcs = [];
// Add the start screen to the game
var startScreen = game.addChild(new StartScreen());
-// Create a clock shape to display time in the format 00:00
-var clockText = new Text2('00:00', {
- size: 100,
- fill: "#ffffff"
-});
-clockText.anchor.set(0.5, 0.5);
-clockText.x = 2048 / 2;
-clockText.y = 100; // Position the clock at the top center of the screen
-LK.gui.top.addChild(clockText);
+var timerText;
function initializeGame(mode) {
+ // Initialize and display the timer
+ timerText = new Text2('Time: 0', {
+ size: 100,
+ fill: "#ffffff"
+ });
+ timerText.anchor.set(0.5, 0);
+ LK.gui.top.addChild(timerText);
+ var startTime = Date.now();
+ LK.setInterval(function () {
+ var elapsedTime = Math.floor((Date.now() - startTime) / 1000);
+ timerText.setText('Time: ' + elapsedTime);
+ }, 1000);
console.log("Selected Game Mode:", mode);
if (mode === 'mode2') {
game.setBackgroundColor(0x8B0000); // Set background to dark red for NIGHTMARE MODE
}
@@ -285,17 +289,8 @@
npc.x = Math.random() * 2048;
npc.y = Math.random() * 2732;
npcs.push(npc);
}
- // Create a clock shape to display time in the format 00:00
- var clockText = new Text2('00:00', {
- size: 100,
- fill: "#ffffff"
- });
- clockText.anchor.set(0.5, 0.5);
- clockText.x = 2048 / 2;
- clockText.y = 100; // Position the clock at the top center of the screen
- LK.gui.top.addChild(clockText);
}
// Handle player movement
game.move = function (x, y, obj) {
if (player) {