X
This commit is contained in:
@@ -48,6 +48,11 @@ const glassOptions = [
|
|||||||
{ color: laserColors.blue, maxAmount: 1, currentAmount: 1 },
|
{ color: laserColors.blue, maxAmount: 1, currentAmount: 1 },
|
||||||
{ color: laserColors.yellow, maxAmount: 1, currentAmount: 1 },
|
{ color: laserColors.yellow, maxAmount: 1, currentAmount: 1 },
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
{ color: laserColors.red, maxAmount: 2, currentAmount: 2 },
|
||||||
|
{ color: laserColors.blue, maxAmount: 2, currentAmount:2},
|
||||||
|
{ color: laserColors.yellow, maxAmount: 2, currentAmount: 2 },
|
||||||
|
],
|
||||||
[
|
[
|
||||||
{ color: laserColors.red, maxAmount: 2, currentAmount: 2 },
|
{ color: laserColors.red, maxAmount: 2, currentAmount: 2 },
|
||||||
{ color: laserColors.blue, maxAmount: 1, currentAmount: 1 },
|
{ color: laserColors.blue, maxAmount: 1, currentAmount: 1 },
|
||||||
@@ -84,12 +89,12 @@ 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, 6, 6, 6, 6, 6, 7, 10, 6, 6, 11, 0, 0, 0, 0],
|
[0, 6, 6, 6, 6, 6, 0, 10, 6, 6, 11, 0, 0, 0, 0],
|
||||||
[0, 1, 0, 0, 0, 4, 0, 0, 0, 3, 21, 0, 0, 0, 0],
|
[7, 1, 0, 0, 0, 4, 0, 0, 0, 3, 21, 0, 0, 0, 0],
|
||||||
[0, 6, 6, 6, 6, 18, 6, 26, 22, 0, 18, 0, 0, 0, 0],
|
[0, 6, 6, 6, 6, 18, 6, 26, 22, 0, 18, 0, 0, 0, 0],
|
||||||
[0, 6, 9, 0, 0, 19, 0, 0, 0, 12, 18, 0, 0, 0, 0],
|
[0, 6, 9, 0, 0, 19, 0, 0, 0, 12, 18, 0, 0, 0, 0],
|
||||||
[0, 6, 0, 6, 6, 6, 6, 6, 6, 24, 23, 0, 0, 0, 0],
|
[0, 6, 0, 6, 6, 6, 6, 6, 6, 24, 23, 0, 0, 0, 0],
|
||||||
[0, 6, 11, 0, 0, 0, 0, 0, 25, 23, 9, 0, 0, 0, 0],
|
[0, 6, 11, 0, 0, 0, 0, 0, 20, 23, 9, 0, 0, 0, 0],
|
||||||
[0, 10, 6, 6, 6, 6, 6, 6, 6, 9, 0, 0, 0, 0, 0],
|
[0, 10, 6, 6, 6, 6, 6, 6, 6, 9, 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],
|
||||||
@@ -131,9 +136,9 @@ const initialMirrorAngles = [
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
"9,4": 315,
|
"2,9": 225,
|
||||||
"2,9": 45,
|
|
||||||
},
|
},
|
||||||
|
{}
|
||||||
];
|
];
|
||||||
|
|
||||||
const buttonGroups = [
|
const buttonGroups = [
|
||||||
@@ -168,11 +173,11 @@ const rotatorButtons = [
|
|||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
"3,7": { mirrorX: 7, mirrorY: 7, step: -22.5, intervalMs: 1000 },
|
"6,8": { mirrorX: 9, mirrorY: 2, step: 22.5, intervalMs: 1000 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"6,8": { mirrorX: 9, mirrorY: 2, step: 22.5, intervalMs: 1000 },
|
"3,7": { mirrorX: 7, mirrorY: 7, step: -22.5, intervalMs: 1000 },
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let laserDirection = { dx: 0, dy: 0 };
|
let laserDirection = { dx: 0, dy: 0 };
|
||||||
@@ -896,7 +901,7 @@ function traceLaser() {
|
|||||||
switch (cellType) {
|
switch (cellType) {
|
||||||
case legend.laser:
|
case legend.laser:
|
||||||
case legend.coloredLaser:
|
case legend.coloredLaser:
|
||||||
laserActive = false;
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case legend.empty:
|
case legend.empty:
|
||||||
@@ -938,7 +943,8 @@ function traceLaser() {
|
|||||||
break;
|
break;
|
||||||
case legend.horizontalSemi:
|
case legend.horizontalSemi:
|
||||||
if (currentLaserColor === laserColors.blue) {
|
if (currentLaserColor === laserColors.blue) {
|
||||||
laserDirection = reverseLaser(laserDirection);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
|
laserDirection = reflectLaser(laserDirection, 0);
|
||||||
} else if (currentLaserColor === laserColors.yellow) {
|
} else if (currentLaserColor === laserColors.yellow) {
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
} else {
|
} else {
|
||||||
@@ -975,34 +981,6 @@ function traceLaser() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case legend.captor:
|
case legend.captor:
|
||||||
case legend.demiWallCornerDownLeft:
|
|
||||||
if (currentLaserColor === laserColors.blue) {
|
|
||||||
laserDirection = reverseLaser(laserDirection);
|
|
||||||
} else if (currentLaserColor === laserColors.yellow) {
|
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
|
||||||
} else {
|
|
||||||
laserActive = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case legend.demiWallCornerDownRight:
|
|
||||||
if (currentLaserColor === laserColors.blue) {
|
|
||||||
laserDirection = reverseLaser(laserDirection);
|
|
||||||
} else if (currentLaserColor === laserColors.yellow) {
|
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
|
||||||
} else {
|
|
||||||
laserActive = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case legend.demiWallCornerUpLeft:
|
|
||||||
if (currentLaserColor === laserColors.blue) {
|
|
||||||
laserDirection = reverseLaser(laserDirection);
|
|
||||||
} else if (currentLaserColor === laserColors.yellow) {
|
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
|
||||||
} else {
|
|
||||||
laserActive = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case legend.demiWallCornerUpRight:
|
|
||||||
if (currentLaserColor === laserColors.blue) {
|
if (currentLaserColor === laserColors.blue) {
|
||||||
laserDirection = reverseLaser(laserDirection);
|
laserDirection = reverseLaser(laserDirection);
|
||||||
} else if (currentLaserColor === laserColors.yellow) {
|
} else if (currentLaserColor === laserColors.yellow) {
|
||||||
@@ -1089,6 +1067,7 @@ function traceLaser() {
|
|||||||
if (currentLaserColor === laserColors.yellow) {
|
if (currentLaserColor === laserColors.yellow) {
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
} else if (currentLaserColor === laserColors.blue) {
|
} else if (currentLaserColor === laserColors.blue) {
|
||||||
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
laserDirection = reflectLaser(laserDirection, 135);
|
laserDirection = reflectLaser(laserDirection, 135);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1097,6 +1076,7 @@ function traceLaser() {
|
|||||||
if (currentLaserColor === laserColors.yellow) {
|
if (currentLaserColor === laserColors.yellow) {
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
} else if (currentLaserColor === laserColors.blue) {
|
} else if (currentLaserColor === laserColors.blue) {
|
||||||
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
laserDirection = reflectLaser(laserDirection, 45);
|
laserDirection = reflectLaser(laserDirection, 45);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1105,6 +1085,7 @@ function traceLaser() {
|
|||||||
if (currentLaserColor === laserColors.yellow) {
|
if (currentLaserColor === laserColors.yellow) {
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
} else if (currentLaserColor === laserColors.blue) {
|
} else if (currentLaserColor === laserColors.blue) {
|
||||||
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
laserDirection = reflectLaser(laserDirection, 225);
|
laserDirection = reflectLaser(laserDirection, 225);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1113,6 +1094,7 @@ function traceLaser() {
|
|||||||
if (currentLaserColor === laserColors.yellow) {
|
if (currentLaserColor === laserColors.yellow) {
|
||||||
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
} else if (currentLaserColor === laserColors.blue) {
|
} else if (currentLaserColor === laserColors.blue) {
|
||||||
|
saveLaserSegment(currentX, currentY, laserDirection, currentLaserColor);
|
||||||
laserDirection = reflectLaser(laserDirection, 315);
|
laserDirection = reflectLaser(laserDirection, 315);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1146,17 +1128,17 @@ function goToLevel(levelIndex) {
|
|||||||
isLevelFinished = false;
|
isLevelFinished = false;
|
||||||
stopAllRotatorButtons();
|
stopAllRotatorButtons();
|
||||||
|
|
||||||
|
mirrorOrientations = {};
|
||||||
|
laserSegments = {};
|
||||||
|
activatedButtons = {};
|
||||||
|
openedDoors = {};
|
||||||
|
toggledDoors = {};
|
||||||
|
poweredCaptors = {};
|
||||||
initializeMirrorOrientations();
|
initializeMirrorOrientations();
|
||||||
glassPlacements = {};
|
glassPlacements = {};
|
||||||
resetGlassInventory();
|
resetGlassInventory();
|
||||||
createPalette();
|
createPalette();
|
||||||
loadGrid();
|
loadGrid();
|
||||||
laserSegments = {};
|
|
||||||
mirrorOrientations = {};
|
|
||||||
activatedButtons = {};
|
|
||||||
openedDoors = {};
|
|
||||||
toggledDoors = {};
|
|
||||||
poweredCaptors = {};
|
|
||||||
traceLaser();
|
traceLaser();
|
||||||
|
|
||||||
const winOverlay = document.querySelector(".win-overlay");
|
const winOverlay = document.querySelector(".win-overlay");
|
||||||
|
|||||||
Reference in New Issue
Block a user