Compare commits
4 Commits
1be3750672
...
feature/mi
| Author | SHA1 | Date | |
|---|---|---|---|
| b10b6475d8 | |||
| 2dbfff770f | |||
| a791415bd3 | |||
|
|
577357b090 |
@@ -5,8 +5,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
height: 100%;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,8 +48,10 @@ main {
|
|||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
border: 1px solid #333333;
|
border: 1px solid #333333;
|
||||||
width: 30px;
|
min-width: 60px;
|
||||||
height: 30px;
|
width: auto;
|
||||||
|
min-height: 60px;
|
||||||
|
height: auto;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -85,30 +87,11 @@ main {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 60%;
|
|
||||||
background: linear-gradient(45deg, transparent 48%, #CCCCCC 48%, #CCCCCC 52%, transparent 52%);
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.door {
|
.door {
|
||||||
background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
|
background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
|
||||||
border-color: #654321;
|
border-color: #654321;
|
||||||
}
|
}
|
||||||
|
|
||||||
.door::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 60%;
|
|
||||||
height: 60%;
|
|
||||||
border: 2px solid #FFD700;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
background: radial-gradient(circle at 35% 35%, #FF4444 0%, #CC0000 100%);
|
background: radial-gradient(circle at 35% 35%, #FF4444 0%, #CC0000 100%);
|
||||||
border-color: #990000;
|
border-color: #990000;
|
||||||
|
|||||||
@@ -17,18 +17,19 @@ const legend = {
|
|||||||
|
|
||||||
let grid = [
|
let grid = [
|
||||||
[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, 8, 0, 0, 0, 0, 0, 0, 0, 0],
|
[0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 3, 0, 0],
|
||||||
[0, 0, 3, 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, 0, 0, 0, 0, 0, 0, 0],
|
||||||
[1, 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],
|
||||||
|
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 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],
|
||||||
]
|
]
|
||||||
|
|
||||||
// Function to print grid
|
// Function to print grid
|
||||||
|
let mirrorCoordinates = [];
|
||||||
|
|
||||||
function loadGrid () {
|
function loadGrid () {
|
||||||
const mapDiv = document.getElementById("map"); // Div with map in DOM
|
const mapDiv = document.getElementById("map"); // Div with map in DOM
|
||||||
@@ -53,6 +54,12 @@ function loadGrid () {
|
|||||||
cell.classList.add("colored-laser");
|
cell.classList.add("colored-laser");
|
||||||
break;
|
break;
|
||||||
case legend.mirror:
|
case legend.mirror:
|
||||||
|
const btnMirror = document.createElement("button");
|
||||||
|
btnMirror.classList.add("btn-mirror");
|
||||||
|
btnMirror.addEventListener("click", () => rotateMirror(btnMirror));
|
||||||
|
btnMirror.style.transform = "rotate(0deg)";
|
||||||
|
btnMirror.style.width = "100%";
|
||||||
|
cell.appendChild(btnMirror);
|
||||||
cell.classList.add("mirror");
|
cell.classList.add("mirror");
|
||||||
break;
|
break;
|
||||||
case legend.door:
|
case legend.door:
|
||||||
@@ -82,4 +89,16 @@ function loadGrid () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadGrid();
|
loadGrid();
|
||||||
|
|
||||||
|
// Function to rotate mirror
|
||||||
|
|
||||||
|
function rotateMirror(mirror) {
|
||||||
|
let angle = 0;
|
||||||
|
if (mirror.style.transform == "") {
|
||||||
|
angle = 0;
|
||||||
|
} else {
|
||||||
|
angle = parseInt(mirror.style.transform.split("(")[1].split("deg")[0])%360;
|
||||||
|
}
|
||||||
|
mirror.style.transform = `rotate(${angle+45}deg)`;
|
||||||
|
}
|
||||||
9
web/assets/js/index.js
Normal file
9
web/assets/js/index.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
function rotateMirror(mirror) {
|
||||||
|
let angle = 0;
|
||||||
|
if (mirror.style.transform == "") {
|
||||||
|
angle = 0;
|
||||||
|
} else {
|
||||||
|
angle = parseInt(mirror.style.transform.split("(")[1].split("deg")[0])%360;
|
||||||
|
}
|
||||||
|
mirror.style.transform = `rotate(${angle+45}deg)`;
|
||||||
|
}
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="../../assets/css/index.css">
|
<link rel="stylesheet" href="../../assets/css/game.css">
|
||||||
<title>Game</title>
|
<title>Game</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
|
|
||||||
<script src="../../assets/js/index.js" defer></script>
|
<script src="../../assets/js/game.js" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user