User prompt
uhh remove the stars and "choose your survival challenge" text
User prompt
tidy up the mode choosing
User prompt
MORE SPEED PLS
User prompt
MORE SPEED TO ENEMY
User prompt
make the enemy to SUPER SPEED
User prompt
make impossible mode enemy to 1
User prompt
make impossible mode
User prompt
tidy up the mode choosing
User prompt
chage practice mode text to light blue
User prompt
make the practice mode color to light blue
User prompt
make the practice mode background and the font color to blue
User prompt
add practice mode where killer didnt show up and make the background same as the practice mode font color
User prompt
add in game music
User prompt
make the menu music on the menu and choosing mode screen
User prompt
make a menu song
User prompt
Please fix the bug: 'Error: Game Over: Player has been caught by the enemy!' in or related to this line: 'throw new Error("Game Over: Player has been caught by the enemy!"); // Crash the game' Line Number: 344
User prompt
crash the game if you lose
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'print is not a function' in or related to this line: 'print(mewing);' Line Number: 355
User prompt
Please fix the bug: 'mewing is not defined' in or related to this line: 'print(mewing);' Line Number: 354
Code edit (1 edits merged)
Please save this source code
User prompt
make practice mode
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
/**** * Classes ****/ // Define an Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyBody = self.attachAsset('enemyBody', { anchorX: 0.5, anchorY: 0.5 }); var enemyArms = self.attachAsset('enemyArms', { anchorX: 0.5, anchorY: 0.5 }); var enemyLegs = self.attachAsset('enemyLegs', { anchorX: 0.5, anchorY: 0.5 }); var enemyHead = self.attachAsset('enemyHead', { anchorX: 0.5, anchorY: 0.5 }); enemyArms.y = -enemyBody.height / 4; enemyLegs.y = enemyBody.height / 2; enemyHead.y = -enemyBody.height / 2; self.speed = 6; self.update = function () { // Calculate the direction vector between enemy and NPCs var dxNpc = 0; var dyNpc = 0; var closestNpc = null; var closestDistance = Infinity; for (var i = 0; i < npcs.length; i++) { var dx = npcs[i].x - self.x; var dy = npcs[i].y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < closestDistance) { closestNpc = npcs[i]; closestDistance = distance; } } if (closestNpc) { dxNpc = closestNpc.x - self.x; dyNpc = closestNpc.y - self.y; var magnitudeNpc = Math.sqrt(dxNpc * dxNpc + dyNpc * dyNpc); // Normalize the direction vector dxNpc /= magnitudeNpc; dyNpc /= magnitudeNpc; // Move the enemy towards the closest NPC self.x += dxNpc * self.speed; self.y += dyNpc * self.speed; } else { // Calculate the direction vector between enemy and player var dxPlayer = player.x - self.x; var dyPlayer = player.y - self.y; var magnitudePlayer = Math.sqrt(dxPlayer * dxPlayer + dyPlayer * dyPlayer); // Normalize the direction vector dxPlayer /= magnitudePlayer; dyPlayer /= magnitudePlayer; // Move the enemy towards the player self.x += dxPlayer * self.speed; self.y += dyPlayer * self.speed; } }; }); // Define a MenuScreen class var MenuScreen = Container.expand(function () { var self = Container.call(this); // Play menu music when menu screen is shown LK.playMusic('menuMusic'); // Create title for mode selection var titleText = new Text2('SELECT GAME MODE', { size: 120, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 2732 / 6; self.addChild(titleText); // Create mode buttons in logical difficulty order with consistent styling var practiceButton = new Text2('PRACTICE MODE', { size: 100, fill: 0x87CEEB }); practiceButton.anchor.set(0.5, 0.5); practiceButton.x = 2048 / 2; practiceButton.y = 2732 / 2.8; self.addChild(practiceButton); var easyModeButton = new Text2('EASY MODE', { size: 100, fill: 0x00FF00 }); easyModeButton.anchor.set(0.5, 0.5); easyModeButton.x = 2048 / 2; easyModeButton.y = 2732 / 2.3; self.addChild(easyModeButton); var normalModeButton = new Text2('NORMAL MODE', { size: 100, fill: 0xFFFFFF }); normalModeButton.anchor.set(0.5, 0.5); normalModeButton.x = 2048 / 2; normalModeButton.y = 2732 / 1.9; self.addChild(normalModeButton); var nightmareModeButton = new Text2('NIGHTMARE MODE', { size: 100, fill: 0xFF0000 }); nightmareModeButton.anchor.set(0.5, 0.5); nightmareModeButton.x = 2048 / 2; nightmareModeButton.y = 2732 / 1.8; self.addChild(nightmareModeButton); var impossibleModeButton = new Text2('IMPOSSIBLE MODE', { size: 100, fill: 0x8B0000 }); impossibleModeButton.anchor.set(0.5, 0.5); impossibleModeButton.x = 2048 / 2; impossibleModeButton.y = 2732 / 1.5; self.addChild(impossibleModeButton); // Add event listeners for all mode buttons practiceButton.down = function () { self.destroy(); // Remove menu screen initializeGame('practice'); // Start the game in practice mode }; easyModeButton.down = function () { self.destroy(); // Remove menu screen initializeGame('easy'); // Start the game in easy mode }; normalModeButton.down = function () { self.destroy(); // Remove menu screen initializeGame('mode1'); // Start the game in normal mode }; nightmareModeButton.down = function () { self.destroy(); // Remove menu screen initializeGame('mode2'); // Start the game in nightmare mode }; impossibleModeButton.down = function () { self.destroy(); // Remove menu screen initializeGame('impossible'); // Start the game in impossible mode }; }); // Define a NPC class var NPC = Container.expand(function () { var self = Container.call(this); var npcHead = self.attachAsset('playerHead', { anchorX: 0.5, anchorY: 0.5 }); npcHead.y = -80; var npcBody = self.attachAsset('playerBody', { anchorX: 0.5, anchorY: 0.5 }); var npcArms = self.attachAsset('playerArms', { anchorX: 0.5, anchorY: 0.5 }); npcArms.y = -30; var npcLegs = self.attachAsset('playerLegs', { anchorX: 0.5, anchorY: 0.5 }); npcLegs.y = 40; self.speed = 4; self.update = function () { // Randomly change direction every 60 frames if (LK.ticks % 60 == 0) { self.direction = Math.random() * Math.PI * 2; } // Calculate dx and dy based on the current direction var dx = Math.cos(self.direction); var dy = Math.sin(self.direction); // Move the NPC self.x += dx * self.speed; self.y += dy * self.speed; // Ensure NPC stays within game boundaries if (self.x < 0) { self.x = 0; self.direction = Math.PI - self.direction; } if (self.x > 2048) { self.x = 2048; self.direction = Math.PI - self.direction; } if (self.y < 0) { self.y = 0; self.direction = -self.direction; } if (self.y > 2732) { self.y = 2732; self.direction = -self.direction; } }; }); //<Assets used in the game will automatically appear here> // Define a Player class var Player = Container.expand(function () { var self = Container.call(this); var playerHead = self.attachAsset('playerHead', { anchorX: 0.5, anchorY: 0.5 }); playerHead.y = -80; var playerBody = self.attachAsset('playerBody', { anchorX: 0.5, anchorY: 0.5 }); var playerArms = self.attachAsset('playerArms', { anchorX: 0.5, anchorY: 0.5 }); playerArms.y = -30; var playerLegs = self.attachAsset('playerLegs', { anchorX: 0.5, anchorY: 0.5 }); playerLegs.y = 40; self.speed = 5; self.update = function () { // Player update logic }; }); // Define a StartScreen class var StartScreen = Container.expand(function () { var self = Container.call(this); // Play menu music when start screen is shown LK.playMusic('menuMusic'); // Create a title text for the start screen var titleText = new Text2('NIGHT OF THE MASSACRE 2', { size: 150, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 2732 / 4; self.addChild(titleText); // Create a start game button var startButton = new Text2('Start Game', { size: 150, fill: 0x00FF00 }); startButton.anchor.set(0.5, 0.5); startButton.x = 2048 / 2; startButton.y = 2732 / 2; self.addChild(startButton); // Add event listener to start button startButton.down = function () { self.destroy(); // Remove start screen var menuScreen = game.addChild(new MenuScreen()); // Show game mode selection }; }); // Add the start screen to the game // Define a Tree class var Tree = Container.expand(function () { var self = Container.call(this); var treeTrunk = self.attachAsset('treeTrunk', { anchorX: 0.5, anchorY: 1 }); var treeLeaves = self.attachAsset('treeLeaves', { anchorX: 0.5, anchorY: 1 }); treeLeaves.y = -treeTrunk.height; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0000FF //Init game with blue background }); /**** * Game Code ****/ var enemies = []; var player = null; var npcs = []; // Add the start screen to the game var startScreen = game.addChild(new StartScreen()); var timerText; function initializeGame(mode) { // Stop menu music when game starts LK.stopMusic(); // Play in-game music LK.playMusic('gameMusic'); // Initialize and display the timer timerText = new Text2('Time: 00:00', { size: 100, fill: 0xFFFFFF }); 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); var minutes = Math.floor(elapsedTime / 60); var seconds = elapsedTime % 60; var formattedTime = minutes.toString().padStart(2, '0') + ':' + seconds.toString().padStart(2, '0'); timerText.setText('Time: ' + formattedTime); // End the game when the timer reaches 06:00 if (formattedTime === '06:00') { LK.showGameOver(); } }, 1000); console.log("Selected Game Mode:", mode); if (mode === 'mode2') { game.setBackgroundColor(0x8B0000); // Set background to dark red for NIGHTMARE MODE } else if (mode === 'easy') { game.setBackgroundColor(0x00FF00); // Set background to green for EASY MODE } else if (mode === 'practice') { game.setBackgroundColor(0x87CEEB); // Set background to light blue for PRACTICE MODE } else if (mode === 'impossible') { game.setBackgroundColor(0x4B0000); // Set background to very dark red for IMPOSSIBLE MODE } // Initialize player player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 150; // Initialize enemies (skip in practice mode) if (mode !== 'practice') { if (mode === 'impossible') { // Create 1 enemy for impossible mode var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = Math.random() * 1000; enemy.speed *= 10; // Super speed enemy in IMPOSSIBLE MODE enemies.push(enemy); game.addChild(enemy); } else { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = Math.random() * 1000; if (mode === 'mode2') { enemy.speed *= 1.5; // Increase enemy speed by 50% in NIGHTMARE MODE } else if (mode === 'easy') { enemy.speed *= 0.5; // Decrease enemy speed by 50% in EASY MODE } enemies.push(enemy); game.addChild(enemy); } } // Initialize 30 trees and spread them across the game var trees = []; for (var i = 0; i < 30; i++) { var tree = game.addChild(new Tree()); tree.x = Math.random() * 2048; tree.y = Math.random() * 2732; trees.push(tree); } // Initialize NPCs for (var i = 0; i < 20; i++) { var npc = game.addChild(new NPC()); npc.x = Math.random() * 2048; npc.y = Math.random() * 2732; npc.direction = Math.random() * Math.PI * 2; // Initialize random direction npcs.push(npc); } } // Handle player movement game.move = function (x, y, obj) { if (player) { player.x = x; player.y = y; } }; // Handle shooting game.down = function (x, y, obj) { if (player) { // Logic for player action on down event, if needed } }; // Game update loop game.update = function () { // Update enemies for (var i = 0; i < enemies.length; i++) { enemies[i].update(); if (player.intersects(enemies[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } // Check if any NPC intersects with enemy for (var j = npcs.length - 1; j >= 0; j--) { if (npcs[j] && npcs[j].intersects(enemies[i])) { npcs[j].destroy(); // Destroy NPC npcs.splice(j, 1); // Remove NPC from array } } } };
===================================================================
--- original.js
+++ change.js
@@ -325,9 +325,9 @@
// Create 1 enemy for impossible mode
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 1000;
- enemy.speed *= 2; // Double enemy speed in IMPOSSIBLE MODE
+ enemy.speed *= 10; // Super speed enemy in IMPOSSIBLE MODE
enemies.push(enemy);
game.addChild(enemy);
} else {
var enemy = new Enemy();