From 1b8e4b267692bace728a64144f1f80e031b496b3 Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 13 Mar 2024 03:18:35 +0100 Subject: [PATCH] little fixes --- main.js | 12 ++++++------ style.css | 28 +++++++++++++++------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/main.js b/main.js index c190541..44ed716 100644 --- a/main.js +++ b/main.js @@ -14,13 +14,13 @@ import MazeMesh from './MazeMesh.js' // LOADING -const labyWidth =23 +const labyWidth = 23 const labyHeight = 23 for(let y=0; y < labyHeight; y++) { let tr = document.createElement("tr") labyTable.appendChild(tr) - for(let x=0; x < labyHeight; x++) { + for(let x=0; x < labyWidth; x++) { let td = document.createElement("td") tr.appendChild(td) } @@ -30,7 +30,7 @@ let walls function dig(x, y) { walls[y][x] = false - window.requestAnimationFrame(() => labyTable.children[y].children[x].className = "ground") + labyTable.children[y].children[x].className = "ground" } const directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] @@ -60,9 +60,7 @@ function* endlessLaby() { } walls = Array(labyHeight).fill(true).map(row => Array(labyWidth).fill(true)) - - //let x0 = 2 * Math.floor(labyWidth * Math.random() / 2) + 1 - //let y0 = 2 * Math.floor(labyHeight * Math.random() / 2) + 1 + let x0 = Math.floor(labyWidth / 2) let y0 = Math.floor(labyHeight / 2) @@ -79,8 +77,10 @@ let interval = window.setInterval(() => labyIterator.next(), 200) const loadMngr = new THREE.LoadingManager() const loader = new THREE.TextureLoader(loadMngr) loader.setPath("textures/") +let t0 loadMngr.onStart = function (url, itemsLoaded, itemsTotal) { progress.innerText = "0" + t0 = Date.now() } loadMngr.onProgress = function (url, itemsLoaded, itemsTotal) { progress.innerText = Math.floor(100 * itemsLoaded / itemsTotal) diff --git a/style.css b/style.css index 61d1b80..2f59090 100644 --- a/style.css +++ b/style.css @@ -19,27 +19,29 @@ body { } #labyTable { - width: 230px; - height: 230px; - margin-left: auto; - margin-right: auto; - margin-top: 20vh; - margin-bottom: 5vh; - border-collapse: collapse; + width: 230px; + height: 230px; + margin-left: auto; + margin-right: auto; + margin-top: 20vh; + margin-bottom: 5vh; + border-collapse: collapse; } -td { - width: 10px; - height: 10px; - transition: background-color 1s; +#labyTable td { + width: 10px; + height: 10px; + transition: background-color 1s; + border: 0; + padding: 0; } .wall { - background-color: transparent; + background-color: transparent; } .ground { - background-color: #214464; + background-color: #214464; } #container {