three v154
This commit is contained in:
@@ -55,6 +55,7 @@ export default class MazeMesh extends THREE.InstancedMesh {
|
||||
|
||||
isWall(position) {
|
||||
if (0 <= position.x && position.x < this.width &&
|
||||
0 <= position.y &&
|
||||
0 <= position.z && position.z < this.length) {
|
||||
return this.map[Math.floor(position.z)][Math.floor(position.x)]
|
||||
} else {
|
||||
@@ -62,6 +63,10 @@ export default class MazeMesh extends THREE.InstancedMesh {
|
||||
}
|
||||
}
|
||||
|
||||
collision(position) {
|
||||
return this.isWall(this.worldToLocal(position))
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.map.map(row =>
|
||||
row.map(isWall => isWall? "██":" ").join("")
|
||||
|
||||
Reference in New Issue
Block a user