User prompt
Please fix the bug: 'Uncaught TypeError: visited.has is not a function' in or related to this line: 'if (neighbor && neighbor.cellType === 'Cell_Occupied' && !visited.has(newRow + ',' + newCol)) {' Line Number: 1439
User prompt
Please fix the bug: 'Uncaught TypeError: visited.add is not a function' in or related to this line: 'visited.add(start.row + ',' + start.col);' Line Number: 1407
User prompt
Please fix the bug: 'Uncaught TypeError: Set is not a constructor' in or related to this line: 'var visited = new Set();' Line Number: 1406
User prompt
Implementing the Breadth-First Search (BFS) Algorithm BFS will help determine if there's a path from Start to Goal by exploring neighboring cells systematically. a. Define the BFS Function Create a function dedicated to performing BFS on the grid. Key Components of BFS: Queue: A data structure to keep track of cells to explore. Visited Set: Keeps track of cells already examined to prevent redundant checks. Directions: Define possible movements (up, down, left, right) from the current cell. b. Steps of the BFS Algorithm Start Initialization: Enqueue Start Cell: Begin by adding the Start cell to the queue. Mark as Visited: Add the Start cell to the Visited set. Exploration Loop: Dequeue a Cell: Remove the first cell from the queue to examine it. Check for Goal: If the dequeued cell is the Goal cell, a path exists. Proceed to play the Win_Level sound. Explore Neighbors: For each direction (up, down, left, right): Calculate Neighbor Coordinates: Determine the adjacent cell's row and column. Boundary Check: Ensure the neighbor is within grid bounds. State Check: Only consider neighbors that are Cell_Occupied. Visited Check: If the neighbor hasn't been visited: Enqueue Neighbor: Add it to the queue for future exploration. Mark as Visited: Add it to the Visited set. Termination: Queue Empty: If the queue is emptied without encountering the Goal cell, no path exists.
User prompt
Initialize the Grid and Cell States Before implementing the algorithm, ensure that your grid is correctly set up with cell states. Grid Representation: Rows and Columns: Represent the grid as a 2D array with rows and columns. Cell States: Cell_Empty: Cells where players can place Regular Tiles. Cell_Occupied: Cells that are already occupied, including Start and Goal cells. Start and Goal Cells: Placement: Place the Start and Goal cells at predefined locations on the grid. State Assignment: Set both Start and Goal cells to Cell_Occupied to allow adjacent tile placements.
User prompt
Once connectivity between the Start and Goal cells is established, proceed with playing the Win_Level sound.
User prompt
Implement the Algorithm Within Level 6 Trigger Point: Invoke the pathfinding check after each tile placement to assess whether the latest move connects the path. Algorithm Steps: Initialize: Start from the Start cell. Maintain a list or set to track visited cells to prevent redundant checks. Explore Neighbors: For the current cell, examine its adjacent cells (up, down, left, right). Only consider cells that are Cell_Occupied. Recursion/Iteration: Recursively or iteratively explore each eligible neighbor. Continue until the Goal cell is reached or all possible paths are exhausted. Determine Connectivity: Connected: If the Goal cell is reached during exploration. Not Connected: If exploration ends without reaching the Goal cell.
User prompt
when the start and goal cells have been connected in level 6, play the Win_Level sound
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'if (grid[row][col] && grid[row][col].cellType === 'Cell_Occupied') {' Line Number: 955
User prompt
when the start and goal cells have been connected, play the Win_Level sound
User prompt
To ensure these rules are correctly implemented in your game, consider the following steps: Initialization Mark Start and Goal: Assign specific cells as Start and Goal at the beginning of Level 6. Set their state to Cell_Occupied. Tile Placement Logic Event Handling: Attach event listeners to Cell_Empty cells to handle tile placement attempts. Adjacency Verification: When a player attempts to place a tile, check all four neighboring cells (up, down, left, right) to confirm at least one is Cell_Occupied. State Update: Upon valid placement, change the cell's state from Cell_Empty to Cell_Occupied. Update the visual representation accordingly.
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'cellType')' in or related to this line: 'if (row < 0 || row >= gridSize || col < 0 || col >= gridSize || visited[row][col] || grid[row][col].cellType !== 'Cell_Occupied') {' Line Number: 1138
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading '5')' in or related to this line: 'if (row < 0 || row >= gridSize || col < 0 || col >= gridSize || visited[row][col] || grid[row][col].cellType !== 'Cell_Occupied') {' Line Number: 1134
User prompt
Please fix the bug: 'ReferenceError: grid is not defined' in or related to this line: 'if (row < 0 || row >= gridSize || col < 0 || col >= gridSize || visited[row][col] || grid[row][col].cellType !== 'Cell_Occupied') {' Line Number: 1133
User prompt
Please fix the bug: 'ReferenceError: gridSize is not defined' in or related to this line: 'var visited = Array.from({' Line Number: 1126
User prompt
The objective is to create a continuous path of occupied cells from the Start to the Goal. Tile Expansion: Players continue placing Regular Tiles on eligible cells, expanding the path towards the Goal.
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'cellType')' in or related to this line: 'if (adjacentCell.cellType === 'Cell_Occupied') {' Line Number: 246
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '3')' in or related to this line: 'var adjacentCell = grid[newRow][newCol];' Line Number: 245
User prompt
Please fix the bug: 'Uncaught ReferenceError: grid is not defined' in or related to this line: 'var adjacentCell = grid[newRow][newCol];' Line Number: 245
User prompt
Level 6: Tile Placement Rules Eligibility Allowed Cells: Players can only place Regular Tiles on cells currently marked as Cell_Empty. Disallowed Cells: Tiles cannot be placed on cells already marked as Cell_Occupied. Adjacency Requirement Continuous Path: Every Regular Tile placed must directly connect (horizontally or vertically) to at least one existing occupied cell. Start and Goal Cells: Initialization: At the beginning of the level, designate specific cells as Start and Goal. Considered Occupied: Both Start and Goal cells are treated as Cell_Occupied, allowing players to place new tiles adjacent to them.
User prompt
i still can't occupy any of the empty tiles after adding the adjacency rule. fix this to ensure empty tiles that have an adjacent occupied tile, are eligible to be turned occupied when tapped. the start and goal cells should be considered as valid occupied cells, when checing the eligibility of the empty cells
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '3')' in or related to this line: 'var adjacentCell = grid[newRow][newCol];' Line Number: 245
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '3')' in or related to this line: 'var adjacentCell = grid[newRow][newCol];' Line Number: 245
User prompt
Please fix the bug: 'Uncaught ReferenceError: grid is not defined' in or related to this line: 'var adjacentCell = grid[newRow][newCol];' Line Number: 245
User prompt
for level 6, here's tile placement rules. Placement Rules: Eligibility: Only Cell_Empty cells receive a Regular Tile. Adjacency: Regular Tiles must connect to existing tiles to form a continuous path from Start to Goal. No Overlapping: Players cannot place tiles on cells already occupied by tiles Cell_Occupied. basically, players can only place tiles on empty cells, as long as that empty cell has a neghboring occupied cell. ensure the start and goal cells placed at the start of the grid, are considered valid occupied cells, thus players should be able to place a new tile on the adjacent cells to them.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BackButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('Button_Back', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.getSound('Back').play(); // Play 'Back' sound effect for (var i = 0; i < levels.length; i++) { levels[i].visible = false; } for (var j = 0; j < levelButtons.length; j++) { levelButtons[j].visible = j < 2 || hiddenAppsVisible; levels[0].visible = true; level0Animation.resetAnimation(); level0Animation.playAnimation(); } // Reset level 4 display to 0000 if (levels[4]) { var displayText = levels[4].children.find(function (child) { return child instanceof Text2; }); if (displayText) { displayText.setText('0000'); inputSequence = [0, 0, 0, 0]; // Reset input sequence to match the display playerSequence = []; // Clear player sequence // Ensure no residual data is reused inputSequence.length = 0; playerSequence.length = 0; } } levels[0].visible = true; // Removed battery percentage reset to make timer independent of the game tween.stop(tutorialFace); tween.stop(tutorialTextBox); tutorialFace.y = tutorialFaceStartPosition; tutorialTextBox.y = tutorialTextBoxStartPosition; isAnimating = false; }; }); var Button = Container.expand(function (levelNumber, assetId) { var self = Container.call(this); var buttonGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); // Add unique name under each app button var appNames = ["Ransomware.exe", "Settings", "Galaxoid", "Safe Storage", "Contacts", "Bitcoin Miner", "Gridoku", "Binary Files", "Cube Cracker", "Photo10110.JPG", "JOIN_US.org", "Reboot"]; var appNameText = new Text2(buttonStates['button_' + levelNumber] ? "Locked" : appNames[levelNumber - 1], { size: 50, fill: 0xFFFFFF, stroke: 0x000000, // Add black outline strokeThickness: 13 // Further increase outline thickness }); appNameText.anchor.set(0.5, 0); appNameText.y = buttonGraphics.height / 2 + 20; // Position below the button self.addChild(appNameText); self.down = function (x, y, obj) { for (var i = 0; i < levels.length; i++) { levels[i].visible = false; } for (var j = 0; j < levelButtons.length; j++) { levelButtons[j].visible = false; // Ensure all app buttons are hidden when entering a level } // hiddenAppsVisible state should not be reset when entering a level levels[levelNumber].visible = true; if (levelNumber === 9 && isCubeCorrect) { var level9 = levels[levelNumber]; level9.removeChild(level9.cubeCorrupt); level9.removeChild(level9.cubeCorrupt2); level9.addChild(level9.cubeCorrect); } // Trigger tutorial animation if entering levels 1-8 if (levelNumber >= 1 && levelNumber <= 10) { tween.stop(tutorialFace); tween.stop(tutorialTextBox); tutorialFace.y = tutorialFaceStartPosition; tutorialTextBox.y = tutorialTextBoxStartPosition; isAnimating = false; levels[levelNumber]._animateTutorialAssets(); } }; }); var Cube = Container.expand(function (type) { var self = Container.call(this); var assetId = type === 'correct' ? 'Cube_Correct' : type === 'corrupt' ? 'Cube_Corrupt' : 'Cube_Corrupt_2'; var cubeGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 - 200, scaleX: 0.8, // Shrink width by 20% scaleY: 0.8 // Shrink height by 20% }); }); var Key = Container.expand(function () { var self = Container.call(this); var keyGraphics = self.attachAsset('Key', { anchorX: 0.5, anchorY: 0.5 }); // Ensure the key is fully opaque keyGraphics.alpha = 1.0; // Attach Button_Back to increase hitbox var buttonBackGraphics = self.attachAsset('Button_Back', { anchorX: 0.5, anchorY: 0.5 }); buttonBackGraphics.alpha = 0.0; // Make it invisible but interactive buttonBackGraphics.interactive = true; buttonBackGraphics.down = function (x, y, obj) { self.isDragging = true; self.startDragX = x - self.x; // Store initial offset self.startDragY = y - self.y; }; buttonBackGraphics.move = function (x, y, obj) { if (self.isDragging) { self.x = Math.max(0, Math.min(2048, x - self.startDragX)); self.y = Math.max(0, Math.min(2732, y - self.startDragY)); } }; buttonBackGraphics.up = function (x, y, obj) { self.isDragging = false; self.x = x - self.startDragX; // Ensure the key stays at the drop position self.y = y - self.startDragY; // Check for collision with lock var lock = self.parent.children.find(function (child) { return child instanceof Lock; }); if (lock && self.intersects(lock)) { // Play unlock sound LK.getSound('Win_Level').play(); // Consolidate unlock logic for App 2 and App 3 unlockApp(2); // Unlock App 2 unlockApp(3); // Unlock App 3 // Destroy the key after it contacts the lock self.destroy(); } }; self.addChild(buttonBackGraphics); self.addChild(keyGraphics); // Ensure keyGraphics is added after buttonBackGraphics }); var Level = Container.expand(function (levelNumber) { var self = Container.call(this); function isAdjacentToOccupied(row, col) { var directions = [{ row: -1, col: 0 }, // Up { row: 1, col: 0 }, // Down { row: 0, col: -1 }, // Left { row: 0, col: 1 } // Right ]; for (var i = 0; i < directions.length; i++) { var newRow = row + directions[i].row; var newCol = col + directions[i].col; if (newRow >= 0 && newRow < gridSize && newCol >= 0 && newCol < gridSize) { var adjacentCell = grid[newRow][newCol]; if (adjacentCell && adjacentCell.cellType === 'Cell_Occupied') { return true; } } } return false; } // Attach the corresponding level asset as the background of the level if (levelNumber === 6) { var gridSize = 6; var grid = Array.from({ length: gridSize }, function () { return Array(gridSize).fill(null); }); // Initialize the grid array var cellSize = 250; var gridOffsetX = 2048 / 2 - gridSize * cellSize / 2; var gridOffsetY = 2732 / 2 - gridSize * cellSize / 2; var startCell = { row: Math.random() < 0.5 ? 0 : gridSize - 1, // Randomly choose between 0 or gridSize-1 col: Math.random() < 0.5 ? 0 : gridSize - 1 // Randomly choose between 0 or gridSize-1 }; // Random start cell in one of the four corners var goalCell = { row: gridSize - 1 - startCell.row, col: gridSize - 1 - startCell.col }; // Goal cell in the opposite corner for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { var cellType = row === startCell.row && col === startCell.col || row === goalCell.row && col === goalCell.col ? 'Cell_Occupied' : 'Cell_Empty'; var cell = LK.getAsset(cellType, { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * cellSize, y: gridOffsetY + row * cellSize }); cell.down = function (cell, cellType, row, col) { return function (x, y, obj) { if (cellType === 'Cell_Empty' && isAdjacentToOccupied(row, col)) { var newType = 'Cell_Occupied'; var newCell = LK.getAsset(newType, { anchorX: 0.5, anchorY: 0.5, x: cell.x, y: cell.y }); self.removeChild(cell); self.addChild(newCell); cell = newCell; cellType = newType; } }; }(cell, cellType, row, col); self.addChild(cell); } } } else { var levelBackground = self.attachAsset('level' + levelNumber, { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: levelNumber === 2 ? 2732 / 2 + 100 : 2732 / 2 }); } if (levelNumber === 2) { var settingsContainer = new Container(); var toggleText = new Text2('Show hidden files: OFF', { size: 50, fill: 0x000000 // Removed outline }); toggleText.anchor.set(0.5, 0.5); toggleText.x = 2048 / 2; toggleText.y = 2732 / 2 - 200; settingsContainer.addChild(toggleText); toggleText.down = function (x, y, obj) { hiddenAppsVisible = !hiddenAppsVisible; toggleText.setText('Show hidden files: ' + (hiddenAppsVisible ? 'ON' : 'OFF')); for (var j = 2; j < 7; j++) { levelButtons[j].visible = hiddenAppsVisible && levels[0].visible; } }; self.addChild(settingsContainer); } else if (levelNumber === 10) { levelBackground = self.attachAsset('level10', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Add Glitch asset to the center of level 10 var glitch = LK.getAsset('Glitch', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 - 95, y: 2732 / 2 - 110 }); self.addChild(glitch); levelBackground.down = function (x, y, obj) { if (glitch.alpha > 0) { glitch.alpha -= 0.02; } }; } else if (levelNumber === 3) { var gameButtons = []; var buttonsPressed = 0; // Track the number of buttons pressed var tapsToDeduct = Math.floor(Math.random() * 10) + 4; // Randomize between 3 and 9 taps // Add click event to level3 asset to deplete battery by 1% levelBackground.down = function (x, y, obj) { buttonsPressed++; // Increment the tap count if (buttonsPressed >= tapsToDeduct) { batteryPercentage = Math.max(0, batteryPercentage - 1); // Deplete battery by 1% LK.getSound('Wrong').play(); // Play 'Wrong' sound when level3 asset is clicked batteryTxt.setText(Math.floor(batteryPercentage) + '%'); // Update battery text display // Add blink effect to battery text var batteryBlink = new BatteryBlink(batteryTxt); batteryBlink.start(); buttonsPressed = 0; // Reset the tap count tapsToDeduct = Math.floor(Math.random() * 3) + 3; // Randomize the next tap count } }; var buttonSize = 150; var horizontalGap = 90; // Horizontal gap between buttons var verticalGap = 60; // Decrease vertical gap between buttons var gridOffsetX = 2048 / 2 - buttonSize * 1.5 - horizontalGap * 1.5 + 630; var gridOffsetY = 2732 / 2 - buttonSize - verticalGap * 0.5 + 590; for (var row = 0; row < 2; row++) { for (var col = 0; col < 3; col++) { var button = LK.getAsset('Game_Button', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * (buttonSize + horizontalGap), y: gridOffsetY + row * (buttonSize + verticalGap), alpha: 1.0 }); button.down = function () { tween(this, { alpha: 0 }, { duration: 500, easing: tween.easeInOut }); buttonsPressed++; if (buttonsPressed === 6) { LK.getSound('Win_Level').play(); } }; self.addChild(button); } } } else if (levelNumber === 4) { var handleKeypadPress = function handleKeypadPress(number) { inputSequence.push(number); // Add the new number to the end if (inputSequence.length > 4) { inputSequence.shift(); // Keep only the last 4 entries } displayText.setText(inputSequence.join('').padStart(4, '0')); // Update display with current sequence }; var gameButtons = []; var buttonArray = []; // Array to hold the two buttons // Create two buttons using the 'Button_Rectangle' asset for (var i = 0; i < 2; i++) { var button = LK.getAsset('Button_Rectangle', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + i * 784 - 400, // Position buttons with a gap y: 2732 / 2 + 770, // Position above the keypad alpha: 0 }); buttonArray.push(button); self.addChild(button); // Add event listener for the Clear button if (i === 0) { // Assuming the first button is the Clear button button.down = function () { var _this2 = this; LK.getSound('Click').play(); // Play the 'Click' sound tween(this, { alpha: 1 }, { // Tween to make button fully visible duration: 100, // Duration for the blink effect easing: tween.easeInOut, onFinish: function onFinish() { tween(_this2, { alpha: 0 }, { // Tween to make button invisible again duration: 100, easing: tween.easeInOut }); } }); inputSequence = [0, 0, 0, 0]; // Reset input sequence displayText.setText('0000'); // Update display to "0000" }; } else if (i === 1) { // Assuming the second button is the Enter button button.down = function () { var _this3 = this; LK.getSound('Click').play(); // Play the 'Click' sound tween(this, { alpha: 1 }, { // Tween to make button fully visible duration: 100, // Duration for the blink effect easing: tween.easeInOut, onFinish: function onFinish() { tween(_this3, { alpha: 0 }, { // Tween to make button invisible again duration: 100, easing: tween.easeInOut }); } }); var currentInput = inputSequence.join(''); var validCodes = ['3885', '1011']; // Predefined valid codes if (validCodes.includes(currentInput)) { console.log('Valid code entered:', currentInput); LK.getSound('Win_Level').play(); // Play 'Win_Level' sound when the correct sequence is entered if (currentInput === '3885') { unlockApp(7); // Unlock App 10 } else if (currentInput === '1011') { unlockApp(5); // Unlock App 5 unlockApp(8); // Unlock App 8 unlockApp(9); // Unlock App 9 } } else { console.log('Invalid code:', currentInput); LK.getSound('Wrong').play(); // Play 'Wrong' sound when the combination is incorrect batteryPercentage = Math.max(0, batteryPercentage - 10); // Deplete battery by 1% per wrong code batteryTxt.setText(Math.floor(batteryPercentage) + '%'); // Update battery text display // Add blink effect to battery text var batteryBlink = new BatteryBlink(batteryTxt); batteryBlink.start(); } inputSequence = [0, 0, 0, 0]; // Reset input sequence displayText.setText('0000'); // Update display to "0000" }; } } // Function to handle keypad button presses var buttonSize = 150; var horizontalGap = 220; // Horizontal gap between buttons var verticalGap = 130; // Increase vertical gap between buttons var gridOffsetX = 2048 / 2 - buttonSize * 1.5 - horizontalGap * 1.5 + 190; var gridOffsetY = 2732 / 2 - buttonSize * 1.5 - verticalGap * 1.5 + 60; // Create a digital display for the 4-digit input var displayText = new Text2('0000', { size: 200, fill: 0xFFFFFF }); displayText.anchor.set(0.5, 0.5); displayText.x = 2048 / 2; displayText.y = gridOffsetY - 370; // Move 200 pixels higher above the keypad self.addChild(displayText); for (var row = 0; row < 4; row++) { for (var col = 0; col < 3; col++) { var button = LK.getAsset('Generic_Button', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * (buttonSize + horizontalGap), y: gridOffsetY + row * (buttonSize + verticalGap), alpha: 0 }); gameButtons.push(button); button.down = function (row, col) { return function () { var _this = this; var number = numberMapping[row * 3 + col + 1]; // Get the number associated with the button handleKeypadPress(number); // Use the new function to handle keypad press LK.getSound('Click').play(); // Play the 'Click' sound tween(this, { alpha: 1 }, { // Tween to make button fully visible duration: 50, // Fast blink effect easing: tween.easeInOut, onFinish: function onFinish() { tween(_this, { alpha: 0 }, { // Tween to fade back to invisible duration: 50, easing: tween.easeInOut }); } }); }; }(row, col); var numberMapping = { 1: 1, 2: 2, 3: 3, 4: 7, 5: 5, 6: 6, 7: 4, 8: 8, 9: 0, 10: '#', 11: 9, 12: '*' }; // Removed dialNumber to hide values from the buttons on the keypad self.addChild(button); } } } else if (levelNumber === 5) { levelBackground = self.attachAsset('level5', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Create a 2x2 grid of Joystick_Button assets var joystickButtons = []; var buttonSounds = ['Call_1', 'Call_2', 'Call_3', 'Call_4']; var buttonSize = 300; var buttonGap = 400; // Increase the gap between buttons by 100 pixels var gridOffsetX = 2048 / 2 - buttonSize - buttonGap + 340; var gridOffsetY = 2732 / 2 - buttonSize - buttonGap + 370; for (var row = 0; row < 2; row++) { for (var col = 0; col < 2; col++) { var button = LK.getAsset('Generic_Button', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * (buttonSize + buttonGap), y: gridOffsetY + row * (buttonSize + buttonGap), scaleX: 3.2, scaleY: 3.2, alpha: 0.0 // Set button alpha to 55% }); joystickButtons.push(button); button.down = function (buttonIndex) { var currentButton = button; // Capture the current button return function (x, y, obj) { LK.getSound(buttonSounds[buttonIndex]).play(); tween(currentButton, { alpha: 1 }, { duration: 50, easing: tween.easeInOut, onFinish: function onFinish() { tween(currentButton, { alpha: 0 }, { duration: 50, easing: tween.easeInOut }); } }); // Disable all buttons joystickButtons.forEach(function (btn) { btn.interactive = false; }); // Re-enable all buttons after 3 seconds LK.setTimeout(function () { joystickButtons.forEach(function (btn) { btn.interactive = true; }); }, 3000); }; }(row * 2 + col); self.addChild(button); } } } else if (levelNumber === 7) { var shiftSudokuGrid = function shiftSudokuGrid(grid) { var shiftX = Math.floor(Math.random() * 3) + 2; // Random shift between 2 and 4 var shiftY = Math.floor(Math.random() * 3) + 2; // Random shift between 2 and 4 // Shift rows for (var i = 0; i < grid.length; i++) { grid[i] = grid[i].slice(shiftX).concat(grid[i].slice(0, shiftX)); } // Shift columns for (var j = 0; j < grid[0].length; j++) { var column = []; for (var k = 0; k < grid.length; k++) { column.push(grid[k][j]); } column = column.slice(shiftY).concat(column.slice(0, shiftY)); for (var l = 0; l < grid.length; l++) { grid[l][j] = column[l]; } } }; // Shift the Sudoku grid at the start of the level var sudokuGrid = []; var gridSize = 6; var tileSize = 260; // Increase tile size to create a gap between tiles var gridOffsetX = 2048 / 2 - gridSize * tileSize / 2 + 150; var gridOffsetY = 2732 / 2 - gridSize * tileSize / 2 - 100; // Pre-generated valid Sudoku solution var sudokuSolution = [[4, 1, 5, 2, 6, 3], [2, 3, 6, 5, 4, 1], [1, 4, 3, 6, 2, 5], [6, 5, 2, 3, 1, 4], [3, 2, 4, 1, 5, 6], [5, 6, 1, 4, 3, 2]]; // Function to shift numbers in the Sudoku grid shiftSudokuGrid(sudokuSolution); // Create the Sudoku grid for (var row = 0; row < gridSize; row++) { sudokuGrid[row] = []; for (var col = 0; col < gridSize; col++) { var tileContainer = new Container(); tileContainer.x = gridOffsetX + col * tileSize; tileContainer.y = gridOffsetY + row * tileSize; var tileGraphic = tileContainer.attachAsset('Tile', { anchorX: 0.5, anchorY: 0.5 }); tileContainer.number = sudokuSolution[row][col]; tileContainer.row = row; // Set the row property tileContainer.col = col; // Set the col property var tileText = new Text2(tileContainer.number.toString(), { size: 100, fill: 0x000000 }); tileText.anchor.set(0.5, 0.5); tileContainer.addChild(tileText); tileContainer.text = tileText; // Ensure text is accessible sudokuGrid[row][col] = tileContainer; self.addChild(tileContainer); } } // Randomly hide 12 tiles var hiddenTiles = []; while (hiddenTiles.length < 12) { var randomRow = Math.floor(Math.random() * gridSize); var randomCol = Math.floor(Math.random() * gridSize); var tile = sudokuGrid[randomRow][randomCol]; if (!hiddenTiles.includes(tile)) { if (tile.text) { tile.text.visible = false; } var tileTapContainer = new Container(); var tileTapGraphic = tileTapContainer.attachAsset('Tile_Tap', { anchorX: 0.5, anchorY: 0.5 }); var tileTap2Graphic = LK.getAsset('Tile_Tap_2', { anchorX: 0.5, anchorY: 0.5 }); tileTap2Graphic.visible = false; // Ensure alternate frame is hidden initially tileTapContainer.addChild(tileTap2Graphic); tileTapContainer.addChild(tile.text); // Ensure text is over the asset tile.addChild(tileTapContainer); tile.interactive = true; tile.tapContainer = tileTapContainer; // Store reference to the tap container hiddenTiles.push(tile); } hiddenTiles.forEach(function (tile) { tile.down = function (x, y, obj) { LK.getSound('Click').play(); // Play the 'Click' sound if (!tile.text.visible) { tile.text.visible = true; tile.number = 1; tile.text.setText(tile.number.toString()); } else { var currentNumber = tile.number; tile.number = tile.number % 6 + 1; var nextNumber = tile.number; // Switch to Tile_Tap_2 tile.tapContainer.children[0].visible = false; // Hide Tile_Tap tile.tapContainer.children[1].visible = true; // Show Tile_Tap_2 // Revert back to Tile_Tap after 100ms LK.setTimeout(function () { tile.tapContainer.children[0].visible = true; // Show Tile_Tap tile.tapContainer.children[1].visible = false; // Hide Tile_Tap_2 }, 100); // Create a tween for the current number to move down if (tile.text.tweenRef) { tween.stop(tile.text.tweenRef); // Stop any ongoing tween for the tile text } tile.text.y = 0; // Reset text position to center tile.text.alpha = 1; // Reset alpha to 1 tile.text.tweenRef = tween(tile.text, { y: tile.text.y + 20, // Move text down slightly alpha: 0 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { tile.text.setText(nextNumber.toString()); tile.text.y -= 40; // Move text up to simulate coming from top tile.text.alpha = 0; // Create a tween for the next number to appear tween(tile.text, { y: tile.text.y + 20, // Move text back to center alpha: 1 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { tile.text.y = 0; // Ensure text is centered after animation tile.text.alpha = 1; // Ensure text is fully visible } }); } }); } // Check if the current tile's number matches the solution if (tile.number === sudokuSolution[tile.row][tile.col]) { tile.correct = true; } else { tile.correct = false; } // Check if all hidden tiles are correct var allCorrect = hiddenTiles.every(function (t) { return t.correct; }); if (allCorrect) { LK.getSound('Win_Level').play(); // Lock hidden tiles to prevent further interaction hiddenTiles.forEach(function (tile) { tile.interactive = false; }); // Unlock level 10 unlockApp(10); } }; }); } } else if (levelNumber === 11) { levelBackground = self.attachAsset('level11', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); } else if (levelNumber === 12) { levelBackground = self.attachAsset('level12', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Add Restart button var restartButton = new Container(); var restartGraphics = restartButton.attachAsset('Restart', { anchorX: 0.5, anchorY: 0.5 }); restartButton.x = 2048 / 2; // Center horizontally restartButton.y = 2732 / 2 + 100; // Center vertically restartButton.down = function (x, y, obj) { LK.showGameOver(); // Trigger Game Over condition }; self.addChild(restartButton); } if (levelNumber === 1) { var lock = new Lock(); lock.x = 2048 / 2; lock.y = 2732 / 2 + 10; self.addChild(lock); var key = new Key(); key.x = 2048 / 2 - 860; key.y = 2732 / 2 + 790; self.addChild(key); } if (levelNumber >= 1 && levelNumber <= 10) { var _animateTutorialAssets = function animateTutorialAssets() { if (isAnimating) { return; } isAnimating = true; tutorialFace.y = tutorialFaceStartPosition; tutorialTextBox.y = tutorialTextBoxStartPosition; // Intro animation for tutorialFace tween(tutorialFace, { y: tutorialFaceRestPosition // Resting position }, { duration: ANIMATION_DURATION, easing: tween.easeInOut, onFinish: function onFinish() { // Rest position for 5 seconds LK.setTimeout(function () { // Outro animation for tutorialFace tween(tutorialFace, { y: tutorialFaceStartPosition // Starting position }, { duration: ANIMATION_DURATION, easing: tween.easeInOut }); }, REST_DURATION); } }); // Intro animation for tutorialTextBox tween(tutorialTextBox, _defineProperty({ y: tutorialTextBoxRestPosition }, "y", tutorialTextBoxStartY), { duration: ANIMATION_DURATION, easing: tween.easeInOut, onFinish: function onFinish() { // Rest position for 5 seconds LK.setTimeout(function () { // Outro animation for tutorialTextBox tween(tutorialTextBox, _defineProperty({ y: tutorialTextBoxStartPosition }, "y", tutorialTextBoxStartY), { duration: ANIMATION_DURATION, easing: tween.easeInOut }); }, REST_DURATION); } }); }; var tutorialFace = self.attachAsset('Tutorial_Face', { anchorX: 0.0, anchorY: 1.0, x: tutorialFaceStartX, y: tutorialFaceStartPosition // Always below the screen }); // Add event listener to tutorialFace to trigger animation outro on click tutorialFace.down = function (x, y, obj) { tween.stop(tutorialFace); tween.stop(tutorialTextBox); tween(tutorialFace, { y: tutorialFaceStartPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut, onFinish: function onFinish() { isAnimating = false; } }); tween(tutorialTextBox, { y: tutorialTextBoxStartPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut }); }; var tutorialTextBox = new Container(); var tutorialTextBoxGraphics = tutorialTextBox.attachAsset('Tutorial_Text_Box', { anchorX: 0.0, anchorY: 1.0, x: +600, y: tutorialTextBoxStartY // Starting y position for tutorialTextBox }); // Add event listener to tutorialTextBox to trigger animation outro on click tutorialTextBoxGraphics.down = function (x, y, obj) { tween.stop(tutorialFace); tween.stop(tutorialTextBox); tween(tutorialFace, { y: tutorialFaceStartPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut, onFinish: function onFinish() { isAnimating = false; } }); tween(tutorialTextBox, { y: tutorialTextBoxStartPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut }); }; self.addChild(tutorialTextBox); // Define animation duration self._animateTutorialAssets = function () { animateTutorialAsset(tutorialFace, tutorialFaceStartPosition, tutorialFaceRestPosition); animateTutorialAsset(tutorialTextBox, tutorialTextBoxStartPosition, tutorialTextBoxRestPosition); }; var tutorialTextContent = ["Your phone’s locked. Don’t panic, you’ll eventually get it back... But first, crack this simple lock.", "Alright, decent start. You’re curious—good. Who am I? Let’s just say I’m looking for someone with skills. To earn your next app, cut through the noise and find the clear signal. Let’s see if you’re up for it.", "Odd...this game shouldn't be here. It’s glitching and could drain your battery fast!", "You’re getting closer. Each step isn’t just about unlocking apps—it’s about showing you can think deeper. This level’s all about layers. The answer is buried in the code. Strip it back and expose the truth.", "We intercepted some calls from rogue agents. Scrambled and cryptic. Can you decode what they’re saying? This is critical!", "You’ve come far, but this is where most fail. Overthinking is your enemy. The solution is always simpler than it seems. Patterns are everywhere—connect them to escape the maze.", "You’re almost there. This one’s different—it’s about perception. Forget the obvious, focus on what others overlook. The answer is in the patterns you don’t see at first glance. Prove you can think beyond the surface.", "This is the final puzzle. Everything you’ve learned leads here. No shortcuts, no mistakes. Break through this lock, and you’ll prove you’re ready. Show me you’re more than potential—you’re the real deal.", "Level 9: The challenge intensifies. Stay sharp and trust your instincts.", "Level 10: The ultimate test. Prove your mastery and claim victory."]; var tutorialText = new Text2(tutorialTextContent[levelNumber - 1], { size: 50, fill: 0xFFFFFF, wordWrap: true, // Enable word wrap wordWrapWidth: 1000, // Set word wrap width to 1000 pixels stroke: 0x000000, // Add black outline strokeThickness: 10 // Set outline thickness to 3 }); tutorialText.anchor.set(0.5, 0.5); tutorialText.x = tutorialTextBox.width - 100; tutorialText.y = tutorialTextBox.height - 250; tutorialTextBox.addChild(tutorialText); } // Removed gates from level 1 self.isPassed = function () { // Define the condition for the level to be considered as passed // This is a placeholder, replace with the actual condition return false; }; self.update = function () { // Update logic for the level if (levelNumber === 6) { if (isPathComplete(startCell, goalCell)) { LK.getSound('Win_Level').play(); self.visible = false; var nextLevelIndex = levels.indexOf(self) + 1; if (nextLevelIndex < levels.length) { levels[nextLevelIndex].visible = true; } else { LK.showGameWon(); } } } // Check if the level is passed if (self.isPassed()) { // Hide the current level self.visible = false; // Show the next level var nextLevelIndex = levels.indexOf(self) + 1; if (nextLevelIndex < levels.length) { levels[nextLevelIndex].visible = true; } else { // If there are no more levels, the game is won LK.showGameWon(); } } }; }); var Level0Animation = Container.expand(function () { var self = Container.call(this); var level0Asset = self.attachAsset('level0', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, scaleX: 1, scaleY: 1 }); self.playAnimation = function () { tween(level0Asset.scale, { x: 1.3, y: 1.3 }, { duration: 1000, easing: tween.easeInOut }); }; self.resetAnimation = function () { level0Asset.scale.x = 1; level0Asset.scale.y = 1; }; }); var Level9 = Container.expand(function () { var self = Container.call(this); // Add _animateTutorialAssets method to Level9 self._animateTutorialAssets = function () { // Implement the tutorial animation logic for Level 9 animateTutorialAsset(tutorialFace, tutorialFaceStartPosition, tutorialFaceRestPosition); animateTutorialAsset(tutorialTextBox, tutorialTextBoxStartPosition, tutorialTextBoxRestPosition); }; // Attach the level 9 asset as the background var levelBackground = self.attachAsset('level9', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 + 100 }); // Attach a new asset named Cube_Corrupt var cubeCorrupt = new Cube('corrupt'); var cubeCorrupt2 = new Cube('corrupt_2'); var cubeCorrect = new Cube('correct'); self.addChild(cubeCorrupt); // Create a 2 by 2 grid of Joystick_Button var sequenceButtons = []; var inputSequence = [0, 0, 0, 0]; // Initialize the input sequence to match the "0000" display var isCubeCorrect = false; // Track if the cube is in the correct state var correctSequence = [4, 1, 3, 2]; var buttonSize = 400; var gridOffsetX = 2048 / 2 - buttonSize * 2 + 180; var gridOffsetY = 2732 / 2 + 430 + 430; for (var i = 0; i < 4; i++) { var button = LK.getAsset('Button_Round', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + i * (buttonSize + 10), // Adjust horizontal spacing y: gridOffsetY, alpha: 0 // Set button alpha to 0 }); button.buttonIndex = i + 1; // Assign unique identifier to each button sequenceButtons.push(button); self.addChild(button); button.down = function () { var currentButton = button; // Capture the current button return function (x, y, obj) { LK.getSound('Click').play(); // Play the 'Click' sound tween(currentButton, { alpha: 1 }, { duration: 50, easing: tween.easeInOut, onFinish: function onFinish() { tween(currentButton, { alpha: 0 }, { duration: 50, easing: tween.easeInOut }); } }); playerSequence.push(currentButton.buttonIndex); if (playerSequence.length > 4) { playerSequence.shift(); // Keep only the last 4 entries } // Toggle between Cube_Corrupt and Cube_Corrupt_2 if (!isCubeCorrect) { if (self.children.includes(cubeCorrupt)) { self.removeChild(cubeCorrupt); self.addChild(cubeCorrupt2); } else { self.removeChild(cubeCorrupt2); self.addChild(cubeCorrupt); } } if (playerSequence.length === 4) { if (compareSequences(playerSequence, correctSequence)) { LK.getSound('Win_Level').play(); playerSequence = []; self.removeChild(cubeCorrupt); self.removeChild(cubeCorrupt2); self.addChild(cubeCorrect); isCubeCorrect = true; } } }; }(button.buttonIndex); } }); var Lock = Container.expand(function () { var self = Container.call(this); var lockGraphics = self.attachAsset('Lock', { anchorX: 0.5, anchorY: 0.5, alpha: 0 // Set alpha to 0 to make it invisible }); }); //<Assets used in the game will automatically appear here> // Define the Level class var MainMenu = Container.expand(function () { var self = Container.call(this); // Attach the corresponding level asset as the background of the level // Reset tutorial assets to starting positions tutorialFace = self.attachAsset('Tutorial_Face', { anchorX: 0.0, anchorY: 1.0, x: tutorialFaceStartX, y: tutorialFaceStartPosition // Start below the screen }); tutorialTextBox = new Container(); var tutorialTextBoxGraphics = tutorialTextBox.attachAsset('Tutorial_Text_Box', { anchorX: 0.0, anchorY: 1.0, x: tutorialTextBoxStartX, y: tutorialTextBoxStartPosition // Start below the screen }); // Ensure tutorialTextBox is not visible at the start of level 0 tutorialTextBox.visible = false; self.addChild(tutorialTextBox); // Add event listener to unlock level 2 when level 0 is pressed self.down = function (x, y, obj) {}; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x161c27 //Init game with new background color }); /**** * Game Code ****/ //{0.1} function isPathComplete(startCell, goalCell) { var visited = Array.from({ length: gridSize }, function () { return Array(gridSize).fill(false); }); function dfs(row, col) { if (row < 0 || row >= gridSize || col < 0 || col >= gridSize || visited[row][col] || grid[row][col].cellType !== 'Cell_Occupied') { return false; } if (row === goalCell.row && col === goalCell.col) { return true; } visited[row][col] = true; return dfs(row - 1, col) || dfs(row + 1, col) || dfs(row, col - 1) || dfs(row, col + 1); } return dfs(startCell.row, startCell.col); } var level0Animation = new Level0Animation(); game.addChild(level0Animation); level0Animation.playAnimation(); var currentInput = ''; // Initialize currentInput variable to store user input // Initialize button states // Initialize background music LK.playMusic('backgroundMusic'); //{0.1} //{0.1} // New asset for buttons in level 4 // Add new sound asset for 'Wrong' var BatteryBlink = function BatteryBlink(textObject) { this.textObject = textObject; }; BatteryBlink.prototype.start = function () { var _this4 = this; tween(this.textObject.scale, { x: 1.25, y: 1.25 }, { duration: 100, easing: tween.easeInOut, onFinish: function onFinish() { tween(_this4.textObject.scale, { x: 1, y: 1 }, { duration: 100, easing: tween.easeInOut }); } }); }; function unlockApp(appNumber) { // Update App's visual state var appButton = levelButtons[appNumber - 1]; // App index is appNumber - 1 appButton.children[0].destroy(); // Remove the existing locked icon var appIcon = appButton.attachAsset('App_' + appNumber, { anchorX: 0.5, anchorY: 0.5 }); // Attach new App's icon appButton.addChildAt(appIcon, 0); // Add the new icon at the first position appButton.children[1].setText(appNames[appNumber - 1]); // Update text to app's name appButton.interactive = true; // Enable interactivity // Update game state buttonStates['button_' + appNumber] = false; // Mark App as unlocked } // New asset for locked apps // Initialize sound effect Call_4 // Initialize sound effect Call_3 // Initialize sound effect Call_2 // Initialize sound effect Call_1 var appNames = ["Ransomware.exe", "Settings", "Galaxoid", "Safe Storage", "Contacts", "Bitcoin Miner", "Gridoku", "Binary Files", "Cube Cracker", "Photo10110.JPG", "JOIN_US.org", "Reboot"]; var sequenceButtons = []; // Define sequenceButtons array in the global scope var isCubeCorrect = false; // Initialize isCubeCorrect to track cube state var hiddenAppsVisible = false; // Initialize visibility state for Apps 4-12 //{0.1} function compareSequences(seq1, seq2) { if (seq1.length !== seq2.length) { return false; } for (var i = 0; i < seq1.length; i++) { if (seq1[i] !== seq2[i]) { return false; } } return true; } var uiBar = LK.getAsset('UI_Bar', { anchorX: 1.0, anchorY: 0.0, scaleX: 2048 / 2400, // Scale to fit the screen width x: 2048 / 2 - 300, y: -10 // Position at the top of the screen }); LK.gui.top.addChild(uiBar); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) { return t; } var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) { return i; } throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function animateTutorialAsset(asset, startPosition, restPosition) { asset.y = startPosition; // Ensure it starts at the correct position tween(asset, { y: restPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut, onFinish: function onFinish() { LK.setTimeout(function () { tween(asset, { y: startPosition }, { duration: ANIMATION_DURATION, easing: tween.easeInOut }); }, REST_DURATION); } }); } // Define global animation duration variables var ANIMATION_DURATION = 1000; var REST_DURATION = 7000; // Duration for how long the assets stay in the resting position var tutorialTextBoxStartX = 0; // Starting x position for tutorialTextBox // Change the height to 200 to make the button square var tutorialFaceStartX = 0; // Starting x position for tutorialFace var tutorialFaceStartPosition = 4200; // Below screen var tutorialTextBoxStartPosition = 3000; // Below screen var tutorialFaceRestPosition = 2900; // Resting position for tutorialFace var tutorialTextBoxStartY = 1000; // Starting y position for tutorialTextBox var tutorialTextBoxRestPosition = 800; // Resting position for tutorialTextBox // Define tutorialFace and tutorialTextBox globally var tutorialFace; var tutorialTextBox; var isAnimating = false; var score = 0; var level = 1; var maxLevels = 12; var hero = { x: 0, y: 0 }; // Define the hero object var batteryPercentage = 101; var depletionRate = 0.2; // Increase depletion rate to drain battery faster var batteryTxt = new Text2(batteryPercentage + '%', { size: 50, fill: 0x000000 }); batteryTxt.anchor.set(0.5, 0.5); batteryTxt.x = 420; // Move 400 pixels to the right batteryTxt.y = 90; // Move 100 pixels lower LK.gui.top.addChild(batteryTxt); function updateBattery() { batteryPercentage -= depletionRate / 60; // Deplete based on 60 FPS if (batteryPercentage <= 0) { batteryPercentage = 0; transitionToLevel12(); } batteryTxt.setText(Math.floor(batteryPercentage) + '%'); } function transitionToLevel12() { for (var i = 0; i < levels.length; i++) { levels[i].visible = false; } levels[11].visible = true; // Level 12 is at index 11 playerSequence = []; // Reset the puzzle state // Simulate app_12 button press if (levelButtons[11]) { levelButtons[11].down(); } } game.update = function () { updateBattery(); }; // Function to handle move events function handleMove(x, y, obj) { hero.x = x; hero.y = y; } // Initialize button states var buttonStates = { button_1: false, // Unlocked button_2: false, // Unlocked // Locked button_3: false, // Unlocked // Locked button_4: false, // Unlocked button_5: true, // Locked button_6: false, // Unlocked // Locked button_7: true, // Locked button_8: false, // Unlocked // Locked button_9: true, // Locked button_10: true, // Locked button_11: true, // Locked button_12: true // Locked }; // Initialize the levels var levels = []; var mainMenu = new MainMenu(); levels.push(mainMenu); game.addChild(mainMenu); for (var i = 0; i < maxLevels; i++) { var level; if (i + 1 === 9) { level = new Level9(); } else { level = new Level(i + 1); } levels.push(level); game.addChild(level); } // Hide all levels except the first one for (var i = 1; i < levels.length; i++) { levels[i].visible = false; } // Create the debug menu buttons var levelButtons = []; for (var i = 0; i < maxLevels; i++) { // Only create buttons for levels 1 through 8 var buttonGap = 500; // Decrease the gap between buttons by 50 pixels var buttonAsset = buttonStates['button_' + (i + 1)] ? 'App_Locked' : 'App_' + (i + 1); var button = new Button(i + 1, buttonAsset); button.interactive = !buttonStates['button_' + (i + 1)]; button.x = 1024 + (i % 3 - 1) * buttonGap + (i === 11 ? 900 : 0); // Move app 12, 200 pixels to the right button.y = 1366 - 200 + (Math.floor(i / 3) - 1) * buttonGap; // Use the global variable for the gap between buttons vertically button.visible = i < 2 || hiddenAppsVisible && levels[2].visible; // Ensure only apps 1 and 2 are visible initially game.addChild(button); levelButtons.push(button); } for (var i = 1; i < levels.length; i++) { // Start from 1 to skip level 0 if (i !== 12) { // Skip adding back button to level 12 var backButton = new BackButton(); backButton.x = 2048 / 2; backButton.y = 2732 - 200; levels[i].addChild(backButton); } } // Set up event listeners game.move = handleMove; game.down = handleMove; game.up = function (x, y, obj) { // No action needed on up event }; Container.prototype.intersects = function (other) { var a = this.getBounds(); var b = other.getBounds(); return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y; };
===================================================================
--- original.js
+++ change.js
@@ -874,8 +874,20 @@
return false;
};
self.update = function () {
// Update logic for the level
+ if (levelNumber === 6) {
+ if (isPathComplete(startCell, goalCell)) {
+ LK.getSound('Win_Level').play();
+ self.visible = false;
+ var nextLevelIndex = levels.indexOf(self) + 1;
+ if (nextLevelIndex < levels.length) {
+ levels[nextLevelIndex].visible = true;
+ } else {
+ LK.showGameWon();
+ }
+ }
+ }
// Check if the level is passed
if (self.isPassed()) {
// Hide the current level
self.visible = false;
@@ -1044,8 +1056,26 @@
/****
* Game Code
****/
//{0.1}
+function isPathComplete(startCell, goalCell) {
+ var visited = Array.from({
+ length: gridSize
+ }, function () {
+ return Array(gridSize).fill(false);
+ });
+ function dfs(row, col) {
+ if (row < 0 || row >= gridSize || col < 0 || col >= gridSize || visited[row][col] || grid[row][col].cellType !== 'Cell_Occupied') {
+ return false;
+ }
+ if (row === goalCell.row && col === goalCell.col) {
+ return true;
+ }
+ visited[row][col] = true;
+ return dfs(row - 1, col) || dfs(row + 1, col) || dfs(row, col - 1) || dfs(row, col + 1);
+ }
+ return dfs(startCell.row, startCell.col);
+}
var level0Animation = new Level0Animation();
game.addChild(level0Animation);
level0Animation.playAnimation();
var currentInput = ''; // Initialize currentInput variable to store user input
A hologram projection of a rebel secret agent bust, with a futuristic cyberpunk style. The agent is a confident woman in a rugged yet high-tech suit, adorned with subtle anarchist symbols and glowing blue accents. Her look conveys authority and high rank within an underground rebel group, with a determined and defiant expression as she gives hacking instructions to the player.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A background for a game over screen, depicting a mobile phone UI with a depleted battery at 0%. The screen features bold red and yellow colors, creating a sense of urgency and tension. A large, flashing battery icon with a red '0%' and a warning triangle is prominently displayed. The UI includes glitch effects, cracks, or distortion to suggest the phone has been overcharged and malfunctioned. The background is filled with subtle warning messages and symbols in red and yellow tones, enhancing the dramatic and high-stakes atmosphere. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Contacts List app with a subtle futuristic touch. The icon features a clean human avatar face in the center, outlined with smooth lines and a soft glow. The avatar is wearing a minimalist headset, hinting at communication functionality. The background is a gradient of deep blue to teal, with faint light effects to suggest a modern and slightly futuristic aesthetic. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for an Encrypted Code File app. The icon features a clean and minimalistic file graphic in the center, with a padlock symbol overlaying it to indicate encryption. Subtle code lines or binary patterns are faintly visible on the file for a modern touch. The background is a gradient of dark blue to teal, with a soft glow around the edges, conveying security and advanced technology while keeping the design clean and professional.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Calculator app. The icon features a sleek and minimalistic calculator graphic in the center, with clean, simple buttons and a glowing equals sign (=) to highlight its function. The background is a gradient of soft grey to blue, with a subtle hint of light effects to suggest a modern and slightly futuristic aesthetic, while maintaining a clean and professional design. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Settings app. The icon features a simple gear symbol in the center, cleanly outlined with smooth lines. The background is a gradient of grey to dark blue, with a subtle glow around the gear, maintaining a modern and minimalistic aesthetic.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Reboot Warning app. The icon features a circular arrow symbol in the center, paired with a small warning triangle to indicate urgency. The background is a gradient of red to orange, creating a sense of caution while keeping the design clean and modern.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a WIN screen app. The icon features a simple trophy or star symbol in the center, glowing softly to signify achievement. The background is a gradient of gold to yellow, giving the icon a celebratory yet minimalistic look. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Picture File app. The icon features a basic landscape graphic in the center, showing a simple mountain and sun design. The background is a gradient of light green to blue, keeping the aesthetic clean and visually appealing. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A full-screen background depicting a corrupted device overtaken by a ransomware message. The screen is dominated by a bold, alarming warning message in red and white text, with phrases like 'Your device has been locked!' and 'Pay to unlock your files!' prominently displayed. The background is dark, with digital glitch effects, static noise, and distorted text adding to the sense of corruption. Subtly embedded within the chaotic design is a hidden encrypted code, integrated into the distortion or glitch patterns, making it challenging to notice at first glance. The overall aesthetic is tense, urgent, and visually striking, fitting the theme of a high-tech device under attack.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A very simple and minimalistic white key symbol, designed with clean lines and no additional details. The key has a basic rectangular shaft with a small circular head and a single notch, all in a flat white design. The style is subtle and understated, focusing on simplicity and clarity.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create an isometric 3D holographic cube resembling a Rubik's cube. The cube should display the top face and two adjacent side faces, each divided into a 3x3 grid of cells. Each cell must contain either a '1' or a '0' in a glowing cyan-blue monospace font, clearly visible on all three visible faces. A few specific cells across the cube should stand out with their binary digits ('1' or '0') highlighted in bright red. The entire cube should have a holographic look, with glowing gridlines separating the cells and a subtle flicker effect. Ensure the cube appears suspended in mid-air, projecting from a base below, with soft lighting and a sci-fi ambiance.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A sleek game controller inspired by a PlayStation design, viewed from a front perspective. On the left side, there is a cluster of four directional arrow buttons arranged in a cross pattern. On the right side, four distinct circular buttons are arranged in a diamond shape, each with a unique symbol: a blue button with a simple 'X', a red button with a 'O', a green button with a triangle, and a pink button with a square. The controller itself is ergonomic, with a clean and modern design, featuring a matte black surface and subtle accents for a polished and professional gaming aesthetic.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean and minimalistic interface for a voice recorder app, featuring a 2x2 grid layout. Each grid square represents a recording file, displayed as large, distinct tiles. Each tile includes a simple circular play button in the center, with a subtle waveform icon or progress bar beneath it to represent the audio. The background is a soft gradient of light grey to white, ensuring clarity and focus on the files. The design is modern and functional, with smooth edges and a clean UI aesthetic for a professional and user-friendly experience.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Cube Cracking app. The icon features an isometric Rubik's cube in the center, with one side glowing in simple neon blue lines, inspired by Tron, and the opposite side subtly tinted red, with minimal cracks to suggest corruption. The background is a clean gradient of dark grey to black, with a faint glow emanating from the cube's edges. The design remains sleek and minimal, focusing on the contrast between the orderly blue side and the corrupted red side. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean and minimalistic game interface for a Galaxian-inspired game, viewed flat and straight from the front as a mobile app UI. At the bottom of the screen is a sleek, centrally aligned starship designed to fire single projectiles upward. The background features a simple, dark space theme with scattered stars and soft gradients, maintaining a futuristic yet uncluttered aesthetic. At the top of the screen, coins are arranged in an 8-column by 4-row grid formation, resembling a classic bug-like pattern. Among these, four consecutive coins in the central row are replaced with glowing red digits '3,' '6,' '9,' and '8,' positioned prominently. These digits are larger, brighter, and pulse subtly, making them stand out distinctly from the neutral-colored coins while remaining seamlessly integrated into the grid. The clean layout highlights the digits' importance while keeping the overall design sleek and user-friendly. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a Galaxian-inspired game. The icon features the classic shape of a Galaxian enemy in the center, rendered with clean, sharp lines and a subtle glow around its edges. The background is a gradient of deep space blue to black, with faint stars scattered throughout, evoking the feel of a cosmic battlefield. The design is sleek and minimal, balancing nostalgia with a modern touch, making it instantly recognizable and visually appealing. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Design a clean and minimalistic landscape-oriented mobile phone interface inspired by Star Wars, adhering to user-friendly web design principles. The frame has a sleek, weathered industrial aesthetic with rounded edges and a muted metallic finish. The screen is completely empty, providing a clean and open space. At the bottom of the HUD, align four large buttons in a simple, straight row. Each button features a unique, bold shape: a triangle, a square, an X, and a star. The buttons are evenly spaced, brightly colored (e.g., red, green, blue, yellow), and have a subtle glow with smooth, tactile designs to make them visually distinct and user-friendly. The background incorporates faint industrial details, such as subtle panel lines or rivets, to reinforce the Star Wars aesthetic without overwhelming the design. The interface balances functionality and thematic style while maintaining a minimalist and intuitive layout focused on the aligned button array.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
futuristic button with the text saying "RESTART". drawn as a 2D user interface element. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Grey-Tinted Tile: A minimalist and futuristic tile design for a Sudoku game, featuring a perfect square with a smooth, clean surface. The tile has a soft gradient, starting with a light grey center that transitions to a slightly darker grey near the edges, giving it depth and sophistication. A thin, faintly glowing silver-grey border surrounds the tile, adding a subtle futuristic touch while maintaining a sleek and clean appearance. The surface remains blank and ready for interaction.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Blue-Tinted Tile: A clean and sleek tile design, consisting of a perfect square with a soft blue surface. A barely noticeable, thin blue border defines the edges, maintaining a smooth and minimal aesthetic. The tile is blank and pristine, embodying futuristic simplicity. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, featuring a sleek and minimalistic Sudoku-inspired design. The icon showcases a simplified 3x3 section of a Sudoku grid in the center, with clean, thin lines dividing the squares. The background features a gradient of soft gray and white, subtly transitioning to create depth and a polished look. Around the edges, a faint glow or highlight enhances the modern and futuristic aesthetic. The design remains clean and user-friendly, with light accents that give the grid a crisp, high-tech feel while maintaining a minimalist aesthetic.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean mobile app interface designed to display photos from a user’s phone, with a retro aesthetic for the displayed image. The screen showcases a single black-and-white photo, styled to mimic a grainy 90s film capture. The photo shows a young man in his 30s, sitting in an office chair and looking surprised at the camera as if caught off guard. The office environment is cluttered with retro elements like a CRT monitor, stacks of papers, a desk lamp, and a vintage rotary phone. The monitor subtly displays binary code '1011,' hidden among other on-screen data. The photo frame has faint edges, resembling a classic film border, with subtle scratches and grain to enhance the retro feel. The app interface itself is minimal, with a back arrow at the top-left and a small menu icon at the top-right, keeping the focus on the photograph.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a square app store icon with rounded corners, specifically designed for a 'Locked' application. Center the icon with a sleek and minimalist padlock symbol to clearly represent security and protection. Overlay the padlock on a subtle file or document graphic to signify locked or encrypted files. Incorporate faint lines of code or binary digits within the file graphic to add a modern, tech-savvy touch. Use a background gradient transitioning from deep crimson to dark burgundy, creating a sense of urgency and protection. Add a soft red glow around the icon's edges to emphasize security and advanced technology, ensuring the overall design remains clean, professional, and visually striking. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean and functional browser UI displaying an illegal hacking website. The page uses a light, minimalist theme with a subtle grey and white color palette to mimic a legitimate site. The main content area features a grid layout of discreetly labeled icons, each representing hacking tools, scripts, or encrypted data for sale, blending in as if it were a professional tech page. In the top-left corner, a small visual cue, such as an encrypted symbol or a faintly styled link, hints at the site's true purpose without drawing too much attention. The interface is designed to look deceptively ordinary, with clean lines, clear fonts, and minimal decorative elements, giving the appearance of a legitimate web application while concealing its illicit nature. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Blue-Tinted Tile: A clean and sleek tile design, consisting of a perfect square with a soft blue surface. A barely noticeable, thin blue border defines the edges, maintaining a smooth and minimal aesthetic. The tile is blank and pristine, embodying futuristic simplicity.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
green-Tinted Tile: A clean and sleek tile design, consisting of a perfect square with a soft neon green surface. A barely noticeable, thin green border defines the edges, maintaining a smooth and minimal aesthetic. The tile is blank and pristine, embodying futuristic simplicity.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bug Tile: A clean and sleek square tile with a soft red surface, subtly tinted to evoke a futuristic aesthetic. A barely noticeable, thin red border defines the edges, giving it a polished and minimal appearance. Within the tile, faintly visible and almost imperceptible, is the outline of a bug seen from above, blending seamlessly with the red surface. The design maintains a pristine and subtle aesthetic, representing a hidden bug tile within a computer system. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Blue-Tinted Tile: A clean and sleek tile design, consisting of a perfect square with a soft blue surface. A barely noticeable, thin blue border defines the edges, maintaining a smooth and minimal aesthetic. The tile is blank and pristine, embodying futuristic simplicity.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square app store icon with rounded edges, designed for a hacking game about connecting a line. The icon features a highly angular, pixelated snake-like line in bright green, built from sharp, connected shapes aligned perfectly within a square grid. The snake's angular, segmented design conveys the strategic and technological theme of the game. The background is a subtle dark gradient, transitioning from deep grey to black, with faint grid lines barely visible to suggest a digital environment. Scattered subtly in the background are tiny red dots, representing bugs, blending seamlessly into the design without overpowering the focus on the snake. The overall look is clean, modern, and sharp, embodying the futuristic and technical essence of the game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A minimalist UI website icon for a retro hacking app, representing a text-based file. The icon is a simple rectangular shape with a slightly folded corner at the top-right, rendered in a clean, pixel-art style. A few green binary digits ('0' and '1') are subtly displayed across the surface in a small, stylized font, blending seamlessly with the retro theme. The design is stripped down to essential elements, using a monochromatic palette with a soft green glow to evoke the feel of a classic hacking interface. The overall look is clean, minimalist, and perfectly aligned with a retro tech aesthetic.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A square folder icon with rounded edges, designed to represent a storage app for binary files. The folder graphic in the center is smooth and minimalistic, featuring faint, glowing neon accents in matrix green to suggest a post-apocalyptic and tech-savvy theme. Subtle rows of binary digits ('0' and '1') are faintly integrated into the folder's surface, blending seamlessly with the design. The background is a clean gradient transitioning from dark grey to soft teal, evoking a sense of advanced technology and digital precision. The overall appearance is sleek, professional, and minimalistic, making it suitable as a 2D game asset with a blank, high-contrast background and no shadows.
A POV perspective of a retro-futuristic handheld device, its screen glowing softly with greenish-blue digital patterns. The design features a blocky, cyberpunk aesthetic with subtle neon accents along the edges and small, glowing symbols etched into the surface. Chains around the device are mid-shatter, breaking into faintly glowing fragments that drift away, symbolizing its freedom. The screen flickers with faint digital animations, hinting at its restored functionality without being overly complex. The hand holding the device is faintly lit by the neon glow, with the background melting into a dim, urban cyberpunk haze, emphasizing the sleek yet gritty retro-futuristic vibe.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A minimalist UI website icon for a retro hacking app, representing a WiFi connection. The icon features a simple pixel-art style signal symbol with three curved bars radiating outward in blue, evoking a classic WiFi logo. The bars are cleanly rendered with subtle gradients for depth, while a soft neon blue glow surrounds the design to emphasize the cyberpunk aesthetic. The background is dark and minimal, with a faint grid pattern barely visible, aligning with the retro-futuristic theme. The overall design is clean, functional, and perfectly suited for a retro hacking interface. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
futuristic video game green long rectangle button with the text saying "RESTART". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A green, elongated rectangular button designed for a video game UI, viewed straight from the front. The button has a muted neon green surface with a soft, subtle glow, giving it a retro-punk futuristic vibe without overwhelming brightness. The edges are slightly rounded, with a faint cyan outline that adds a touch of depth and complements the design. Centered on the button, the word 'RESTART' appears in a bold, pixel-art font with a faint white outline, ensuring it remains clear and readable. The background is simple and minimal, with a subtle grid texture lightly visible on the button's surface to maintain the retro-futuristic aesthetic without excess glare. The overall design is clean and balanced, perfect for an immersive gaming interface.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.