User prompt
wrong sound doesnt play when i tap a locked app
User prompt
wrong sound doesnt play when i tap a locked app
User prompt
when App_Locked icon is pressed, play Wrong sound
User prompt
Play 'Wrong' sound when a locked app icon is tapped. when App_Locked icon is pressed, play Wrong sound
User prompt
tapping a locked app icon should play the Wrong sound
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'Cell_Empty')' in or related to this line: 'var currentCellType = grid[row][col].cellType; // Access current cellType dynamically' Line Number: 419
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'Cell_Empty')' in or related to this line: 'var currentCellType = grid[row][col].cellType; // Access current cellType dynamically' Line Number: 418
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'Cell_Empty')' in or related to this line: 'var currentCellType = grid[row][col].cellType; // Access current cellType dynamically' Line Number: 418
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'Cell_Empty')' in or related to this line: 'var currentCellType = grid[row][col].cellType; // Access current cellType dynamically' Line Number: 418
User prompt
Variable Capture: The cellType is captured when the handler is defined. If the cell's type changes later, the handler still references the old cellType, potentially allowing unintended interactions. Resolution: Dynamic Reference: Modify the event handler to reference the current cellType directly from the grid data structure at the time of the click, rather than relying on a captured variable. Implementation Steps: Remove Captured cellType: Eliminate the cellType parameter from the handler definition to prevent capturing stale values. Access cellType Dynamically: Within the down event handler, retrieve the current cellType from the grid data structure based on the cell's row and column.
User prompt
Issue: Occasionally, some Cell_Bug cells can still be clicked and transformed into Cell_Occupied cells. Expected Behavior: Once a cell is in the Cell_Bug state, it should not be interactive and should remain unchangeable. Observed Behavior: Only some Cell_Bug cells are affected, not all, suggesting an intermittent issue rather than a systemic one.
User prompt
Please fix the bug: 'Uncaught ReferenceError: gridInteractionEnabled is not defined' in or related to this line: 'if (gridInteractionEnabled && cellType === 'Cell_Empty' && isAdjacentToOccupied(row, col)) {' Line Number: 414
User prompt
Use Flags to Control Interaction Flow: Introduce a flag (e.g., isGridLocked or isResetting) to manage the interaction state during critical operations like resetting the grid. Ensure that during these operations, all cell interactions are appropriately managed or disabled.
User prompt
Objective: Ensure that all bug cells are consistently set to interactive = false across all game states, including after grid resets. Steps: Consistent Application in updateBugs: After identifying a Cell_Bug, set both the new bug asset and the underlying cell asset to interactive = false. Ensure this is done every time bugs are placed or updated. Handle Bug Cells in resetGrid: When resetting the grid, ensure that any cells designated as Cell_Bug have their interactive property set to false. Double-check that the resetGrid method fully reinitializes all cells, applying the correct interaction states based on their cellType. Audit All Grid Modifications: Review all parts of the code where grid cells are modified to ensure that Cell_Bug states are correctly handled. Prevent any inadvertent reactivation of bug cell interactions during other game processes. Benefit: This comprehensive approach ensures that bug cells remain unchangeable throughout the game's lifecycle, maintaining the intended game mechanics.
User prompt
Refactor Event Handlers to Reference Current Cell State Objective: Modify the down event handlers for each cell to dynamically check the current cellType at the time of the click, rather than relying on a captured value. Steps: Remove Captured cellType: In your current cell.down function, you're capturing cellType during handler definition. Instead, eliminate this captured variable. Access cellType Dynamically: Within the down event handler, directly access the cell's current cellType from the grid data structure. This ensures the handler always works with the latest state. Update Condition Checks: Adjust the condition within the down handler to check the current cellType dynamically: Only allow interaction if cellType is Cell_Empty. Ensure that cellType is not Cell_Bug. Benefit: This ensures that once a cell becomes a Cell_Bug, its state is accurately reflected in the interaction logic, preventing it from being modified further.
User prompt
add a flag to the cells when turning into a bug, marking them as bug, thus not being able to change them into a different state when the player taps on them.
User prompt
there's a bug where i can sometimes place new cells over already existing bug cell. disable interaction with cells if they have a bug state on them
User prompt
there's a bug where i can sometimes place new cells over already existing bug cells
User prompt
increase the gap between the app icons
User prompt
the LED system is still non existent inside level 6, i cant see the initial transparent LED assets
Code edit (1 edits merged)
Please save this source code
User prompt
the LED progression system in level 6 is still not visible, ensure it's place in the center of the screen
User prompt
the LED progression system in level 6 is not visible, ensure it's attached to the GUI
User prompt
Create a visual progression system in Level 6 that uses three LED icons arranged in three columns. Each LED starts at 50% transparency and becomes fully visible (100% opacity) as the player achieves successive "Win_Level" events: First Win_Level: First LED becomes fully visible. Second Win_Level: Second LED becomes fully visible. Third Win_Level: Third LED becomes fully visible.
User prompt
after the player has no more moves available in level 6, reset the grid after 1 second instead of 1.5
/**** * 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(); } //{0.1} if (levels[6]) { var gridContainer = levels[6].children.find(function (child) { return child instanceof GridContainer; }); if (gridContainer) { gridContainer.resetGrid(); } } // 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 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 GridContainer = Container.expand(function (gridSize) { var self = Container.call(this); self.updateBugs = function () { var cellSize = 250; var gridOffsetX = 2048 / 2 - self.gridManager.gridSize * cellSize / 2; var gridOffsetY = 2732 / 2 - self.gridManager.gridSize * cellSize / 2; var grid = self.gridManager.getGrid(); for (var r = 0; r < gridSize; r++) { for (var c = 0; c < gridSize; c++) { if (grid[r][c].cellType === 'Cell_Bug') { var bugCell = LK.getAsset('Cell_Bug', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + c * cellSize, y: gridOffsetY + r * cellSize }); self.addChild(bugCell); bugCell.interactive = false; if (grid[r][c].asset) { grid[r][c].asset.interactive = false; // Disable interaction on the original cell } grid[r][c].interactive = false; // Ensure the grid cell itself is non-interactive } } } // Check if there are any possible moves left var possibleMoveExists = false; for (var r = 0; r < gridSize; r++) { for (var c = 0; c < gridSize; c++) { if (grid[r][c].cellType === 'Cell_Empty' && isAdjacentToOccupied(r, c)) { var readyCell = LK.getAsset('Cell_Ready', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + c * cellSize, y: gridOffsetY + r * cellSize, scaleX: 0.5, // Start with a smaller scale scaleY: 0.5 // Start with a smaller scale }); self.addChild(readyCell); tween(readyCell, { scaleX: 1, // Enlarge to normal size scaleY: 1 // Enlarge to normal size }, { duration: 300, // Duration of the animation easing: tween.easeOut // Easing function for smooth transition }); grid[r][c].asset = readyCell; // Update grid data with new asset possibleMoveExists = true; } } } // If no possible moves, play 'Wrong' sound and reset grid after 1 second if (!possibleMoveExists) { LK.getSound('Wrong').play(); LK.setTimeout(function () { self.resetGrid(); }, 1000); } }; self.bfs = function (start, goal, grid, gridSize) { var queue = [start]; var visited = []; visited.push(start.row + ',' + start.col); var directions = [{ row: -1, col: 0 }, // Up { row: 1, col: 0 }, // Down { row: 0, col: -1 }, // Left { row: 0, col: 1 } // Right ]; while (queue.length > 0) { var current = queue.shift(); if (current.row === goal.row && current.col === goal.col) { isGridLocked = true; // Lock grid interactions during BFS operation LK.setTimeout(function () { self.resetGrid(); // Trigger grid reset upon success isGridLocked = false; // Unlock grid interactions after reset }, 1000); return true; } for (var i = 0; i < directions.length; i++) { var newRow = current.row + directions[i].row; var newCol = current.col + directions[i].col; if (newRow >= 0 && newRow < gridSize && newCol >= 0 && newCol < gridSize) { var neighbor = grid[newRow][newCol]; if (neighbor && neighbor.cellType === 'Cell_Occupied' && visited.indexOf(newRow + ',' + newCol) === -1) { queue.push({ row: newRow, col: newCol }); visited.push(newRow + ',' + newCol); } } } } return false; }; self.gridManager = new GridManager(gridSize); var grid = self.gridManager.getGrid(); var startCell = self.gridManager.getStartCell(); var goalCell = self.gridManager.getGoalCell(); var isGridLocked = false; // Flag to control grid interaction during critical operations var cellSize = 250; var gridOffsetX = 2048 / 2 - self.gridManager.gridSize * cellSize / 2; var gridOffsetY = 2732 / 2 - self.gridManager.gridSize * cellSize / 2; 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; } for (var row = 0; row < self.gridManager.gridSize; row++) { for (var col = 0; col < self.gridManager.gridSize; col++) { var cellType = grid[row][col].cellType; if (cellType === 'Cell_Bug') { grid[row][col].interactive = false; // Ensure bug cells are non-interactive } var cell = LK.getAsset(cellType, { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * cellSize, y: gridOffsetY + row * cellSize }); // Store a reference to the cell asset in the grid data self.gridManager.grid[row][col].asset = cell; cell.down = function (row, col) { return function (x, y, obj) { var currentCellType = self.gridManager.grid[row][col].cellType; // Access current cellType dynamically if (!isGridLocked && currentCellType === '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, scaleX: 1.25, // Start with a larger scale scaleY: 1.25 // Start with a larger scale }); self.removeChild(cell); self.addChild(newCell); tween(newCell, { scaleX: 1, scaleY: 1 }, {}); // Animate to normal size cell = newCell; // Update grid state grid[row][col] = { cellType: newType }; // Check if a path exists from start to goal after placing a tile if (self.bfs(startCell, goalCell, grid, self.gridManager.gridSize)) { console.log("Path exists from Start to Goal"); LK.getSound('Win_Level').play(); } else { console.log("No path exists from Start to Goal"); // Trigger Bug Placement System self.gridManager.placeRandomBugs(2); // Use self.gridManager to place bugs self.updateBugs(); // Update the visual representation of bugs gridInteractionEnabled = true; // Ensure interaction remains enabled for subsequent taps } } }; }(cell, cellType, row, col); self.addChild(cell); } } // Method to reset the grid to its default state self.resetGrid = function () { isGridLocked = true; // Lock grid interactions during reset self.gridManager = new GridManager(gridSize); grid = self.gridManager.getGrid(); startCell = self.gridManager.getStartCell(); goalCell = self.gridManager.getGoalCell(); isGridLocked = false; // Unlock grid interactions after reset self.removeChildren(); for (var row = 0; row < self.gridManager.gridSize; row++) { for (var col = 0; col < self.gridManager.gridSize; col++) { var cellType = grid[row][col].cellType; var cell = LK.getAsset(cellType, { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * cellSize, y: gridOffsetY + row * cellSize }); // Store a reference to the cell asset in the grid data self.gridManager.grid[row][col].asset = cell; if (cellType === 'Cell_Bug') { cell.interactive = false; // Ensure bug cells are non-interactive grid[row][col].interactive = false; // Ensure grid data reflects non-interactive state } cell.down = function (row, col) { return function (x, y, obj) { var currentCellType = grid[row][col].cellType; // Access current cellType dynamically if (gridInteractionEnabled && currentCellType === '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, scaleX: 1.25, // Start with a larger scale scaleY: 1.25 // Start with a larger scale }); self.removeChild(cell); self.addChild(newCell); tween(newCell, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); // Animate to normal size cell = newCell; grid[row][col] = { cellType: newType }; if (self.bfs(startCell, goalCell, grid, self.gridManager.gridSize)) { console.log("Path exists from Start to Goal"); LK.getSound('Win_Level').play(); } else { console.log("No path exists from Start to Goal"); self.gridManager.placeRandomBugs(2); self.updateBugs(); } } }; }(cell, cellType, row, col); self.addChild(cell); if (cellType === 'Cell_Empty' && isAdjacentToOccupied(row, col)) { var readyCell = LK.getAsset('Cell_Ready', { anchorX: 0.5, anchorY: 0.5, x: gridOffsetX + col * cellSize, y: gridOffsetY + row * cellSize }); self.addChild(readyCell); grid[row][col].asset = readyCell; } } } }; }); 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); if (levelNumber === 6) { var levelBackground = self.attachAsset('level6', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); self.addChild(levelBackground); var gridContainer = new GridContainer(7); gridContainer.x += 150; // Move grid 200 pixels to the right gridContainer.y += 100; // Move grid 100 pixels lower self.addChild(gridContainer); } 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 // 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 ****/ var gridInteractionEnabled = true; // Initialize gridInteractionEnabled to manage grid interactions function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } //{0.1} var GridManager = function GridManager(gridSize) { this.gridSize = gridSize; this.grid = Array.from({ length: gridSize }, function (_, rowIndex) { return Array.from({ length: gridSize }, function (_, colIndex) { return { cellType: 'Cell_Empty', row: rowIndex, col: colIndex }; }); }); if (Math.random() < 0.5) { this.startCell = { row: 0, col: 0 }; this.goalCell = { row: gridSize - 1, col: gridSize - 1 }; } else { this.startCell = { row: 0, col: gridSize - 1 }; this.goalCell = { row: gridSize - 1, col: 0 }; } // Initialize grid with default state this.grid[this.startCell.row][this.startCell.col] = { cellType: 'Cell_Occupied' }; this.grid[this.goalCell.row][this.goalCell.col] = { cellType: 'Cell_Occupied' }; // Place random bugs this.placeRandomBugs(2); }; GridManager.prototype.placeRandomBugs = function (numberOfBugs) { var emptyCells = []; for (var r = 0; r < this.gridSize; r++) { for (var c = 0; c < this.gridSize; c++) { if (this.grid[r][c].cellType === 'Cell_Empty') { emptyCells.push({ row: r, col: c }); } } } if (emptyCells.length < numberOfBugs) { numberOfBugs = emptyCells.length; // Adjust number of Bugs if fewer empty tiles exist } shuffleArray(emptyCells); var selectedBugs = emptyCells.slice(0, numberOfBugs); selectedBugs.forEach(function (cellPosition) { var r = cellPosition.row; var c = cellPosition.col; this.grid[r][c].cellType = 'Cell_Bug'; if (this.grid[r][c].asset) { this.grid[r][c].asset.interactive = false; // Disable interaction on the cell } this.grid[r][c].interactive = false; // Ensure the grid cell itself is non-interactive if (this.grid[r][c].asset) { this.grid[r][c].asset.interactive = false; // Ensure asset is non-interactive } LK.getSound('Click').play(); // Play the 'Click' sound when a new bug spawns }, this); }; GridManager.prototype.getGrid = function () { return this.grid; }; GridManager.prototype.getStartCell = function () { return this.startCell; }; GridManager.prototype.getGoalCell = function () { return this.goalCell; }; 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", "Voice Recorder", "Virus Wars", "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 = 600; // Increase the gap between buttons by 100 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
@@ -280,9 +280,9 @@
// Store a reference to the cell asset in the grid data
self.gridManager.grid[row][col].asset = cell;
cell.down = function (row, col) {
return function (x, y, obj) {
- var currentCellType = grid[row][col].cellType; // Access current cellType dynamically
+ var currentCellType = self.gridManager.grid[row][col].cellType; // Access current cellType dynamically
if (!isGridLocked && currentCellType === 'Cell_Empty' && isAdjacentToOccupied(row, col)) {
var newType = 'Cell_Occupied';
var newCell = LK.getAsset(newType, {
anchorX: 0.5,
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.