little fixes
This commit is contained in:
parent
dd8361cf33
commit
1b8e4b2676
10
main.js
10
main.js
@ -14,13 +14,13 @@ import MazeMesh from './MazeMesh.js'
|
|||||||
|
|
||||||
// LOADING
|
// LOADING
|
||||||
|
|
||||||
const labyWidth =23
|
const labyWidth = 23
|
||||||
const labyHeight = 23
|
const labyHeight = 23
|
||||||
|
|
||||||
for(let y=0; y < labyHeight; y++) {
|
for(let y=0; y < labyHeight; y++) {
|
||||||
let tr = document.createElement("tr")
|
let tr = document.createElement("tr")
|
||||||
labyTable.appendChild(tr)
|
labyTable.appendChild(tr)
|
||||||
for(let x=0; x < labyHeight; x++) {
|
for(let x=0; x < labyWidth; x++) {
|
||||||
let td = document.createElement("td")
|
let td = document.createElement("td")
|
||||||
tr.appendChild(td)
|
tr.appendChild(td)
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ let walls
|
|||||||
|
|
||||||
function dig(x, y) {
|
function dig(x, y) {
|
||||||
walls[y][x] = false
|
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]]
|
const directions = [[0, 1], [0, -1], [1, 0], [-1, 0]]
|
||||||
@ -61,8 +61,6 @@ function* endlessLaby() {
|
|||||||
|
|
||||||
walls = Array(labyHeight).fill(true).map(row => Array(labyWidth).fill(true))
|
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 x0 = Math.floor(labyWidth / 2)
|
||||||
let y0 = Math.floor(labyHeight / 2)
|
let y0 = Math.floor(labyHeight / 2)
|
||||||
|
|
||||||
@ -79,8 +77,10 @@ let interval = window.setInterval(() => labyIterator.next(), 200)
|
|||||||
const loadMngr = new THREE.LoadingManager()
|
const loadMngr = new THREE.LoadingManager()
|
||||||
const loader = new THREE.TextureLoader(loadMngr)
|
const loader = new THREE.TextureLoader(loadMngr)
|
||||||
loader.setPath("textures/")
|
loader.setPath("textures/")
|
||||||
|
let t0
|
||||||
loadMngr.onStart = function (url, itemsLoaded, itemsTotal) {
|
loadMngr.onStart = function (url, itemsLoaded, itemsTotal) {
|
||||||
progress.innerText = "0"
|
progress.innerText = "0"
|
||||||
|
t0 = Date.now()
|
||||||
}
|
}
|
||||||
loadMngr.onProgress = function (url, itemsLoaded, itemsTotal) {
|
loadMngr.onProgress = function (url, itemsLoaded, itemsTotal) {
|
||||||
progress.innerText = Math.floor(100 * itemsLoaded / itemsTotal)
|
progress.innerText = Math.floor(100 * itemsLoaded / itemsTotal)
|
||||||
|
28
style.css
28
style.css
@ -19,27 +19,29 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#labyTable {
|
#labyTable {
|
||||||
width: 230px;
|
width: 230px;
|
||||||
height: 230px;
|
height: 230px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 20vh;
|
margin-top: 20vh;
|
||||||
margin-bottom: 5vh;
|
margin-bottom: 5vh;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
#labyTable td {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
transition: background-color 1s;
|
transition: background-color 1s;
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wall {
|
.wall {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ground {
|
.ground {
|
||||||
background-color: #214464;
|
background-color: #214464;
|
||||||
}
|
}
|
||||||
|
|
||||||
#container {
|
#container {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user