Level 2
This commit is contained in:
@@ -16,6 +16,8 @@ const legend = {
|
||||
demiWallCornerDownRight: 12,
|
||||
doorOpen: 13,
|
||||
button2: 14,
|
||||
captor: 15,
|
||||
cable: 16,
|
||||
};
|
||||
|
||||
const laserColors = {
|
||||
@@ -44,20 +46,49 @@ let levels = [
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
],
|
||||
|
||||
[
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 11, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 1, 0, 0, 0, 0, 10, 6, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 3, 16, 16, 15, 0, 3, 6, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 6, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 12, 6, 6, 6, 6, 6, 9, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 6, 0, 0, 0, 3, 0, 7, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 6, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 10, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0],
|
||||
],
|
||||
|
||||
[
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
],
|
||||
];
|
||||
|
||||
let currentLevelIndex = 0;
|
||||
|
||||
const initialMirrorAngles = {
|
||||
"6,4": 315,
|
||||
"4,3": 315,
|
||||
};
|
||||
|
||||
const buttonGroups = {
|
||||
"4,6": 1,
|
||||
"4,7": 2,
|
||||
};
|
||||
|
||||
const doorGroups = {
|
||||
"4,7": 1,
|
||||
"4,8": 2,
|
||||
};
|
||||
|
||||
let laserDirection = { dx: 0, dy: 0 };
|
||||
@@ -371,6 +402,12 @@ function loadGrid() {
|
||||
case legend.demiWallCornerDownRight:
|
||||
cell.classList.add("demi-wall-corner-down-right");
|
||||
break;
|
||||
case legend.captor:
|
||||
cell.classList.add("captor");
|
||||
break;
|
||||
case legend.cable:
|
||||
cell.classList.add("cable");
|
||||
break;
|
||||
}
|
||||
|
||||
drawLaserInCell(cell, laserSegments[`${y},${x}`]);
|
||||
@@ -550,6 +587,27 @@ function finish() {
|
||||
const winOverlay = document.querySelector(".win-overlay");
|
||||
winOverlay.style.visibility = "visible";
|
||||
}, 100);
|
||||
|
||||
nextLevel();
|
||||
}
|
||||
|
||||
function nextLevel () {
|
||||
currentLevelIndex++;
|
||||
|
||||
isLevelFinished = false;
|
||||
|
||||
if (currentLevelIndex >= levels.length) {
|
||||
currentLevelIndex = 0;
|
||||
}
|
||||
|
||||
initializeMirrorOrientations();
|
||||
loadGrid();
|
||||
laserSegments = {};
|
||||
mirrorOrientations = {};
|
||||
glassPlacements = {};
|
||||
activatedButtons = {};
|
||||
openedDoors = {};
|
||||
traceLaser();
|
||||
}
|
||||
|
||||
createPalette();
|
||||
|
||||
Reference in New Issue
Block a user