Compare commits
4 Commits
1be3750672
...
b10b6475d8
| Author | SHA1 | Date | |
|---|---|---|---|
| b10b6475d8 | |||
| 2dbfff770f | |||
| a791415bd3 | |||
|
|
577357b090 |
@@ -5,8 +5,8 @@
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,10 @@ main {
|
||||
|
||||
.cell {
|
||||
border: 1px solid #333333;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
min-width: 60px;
|
||||
width: auto;
|
||||
min-height: 60px;
|
||||
height: auto;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -85,30 +87,11 @@ main {
|
||||
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 {
|
||||
background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
|
||||
border-color: #654321;
|
||||
}
|
||||
|
||||
.door::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
border: 2px solid #FFD700;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.button {
|
||||
background: radial-gradient(circle at 35% 35%, #FF4444 0%, #CC0000 100%);
|
||||
border-color: #990000;
|
||||
|
||||
@@ -17,18 +17,19 @@ const legend = {
|
||||
|
||||
let grid = [
|
||||
[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, 3, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 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],
|
||||
]
|
||||
|
||||
// Function to print grid
|
||||
let mirrorCoordinates = [];
|
||||
|
||||
function loadGrid () {
|
||||
const mapDiv = document.getElementById("map"); // Div with map in DOM
|
||||
@@ -53,6 +54,12 @@ function loadGrid () {
|
||||
cell.classList.add("colored-laser");
|
||||
break;
|
||||
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");
|
||||
break;
|
||||
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>
|
||||
<meta charset="UTF-8">
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
|
||||
<script src="../../assets/js/index.js" defer></script>
|
||||
<script src="../../assets/js/game.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user