add minimap

This commit is contained in:
2024-12-23 10:08:06 +09:00
parent e23978ea90
commit 604368b52c
5 changed files with 46 additions and 12 deletions
+2 -2
View File
@@ -61,8 +61,8 @@ export default class Entity {
const speed = this.speed / (this.game?.tickBudget ?? 1000)
if (this.#dest != null) {
const fixedDest = new THREE.Vector2(
Math.min(Math.max(this.radius, this.#dest.x), this.game?.width ?? Infinity),
Math.min(Math.max(this.radius, this.#dest.y), this.game?.height ?? Infinity),
Math.min(Math.max(this.radius, this.#dest.x), (this.game?.width ?? Infinity) - this.radius),
Math.min(Math.max(this.radius, this.#dest.y), (this.game?.height ?? Infinity) - this.radius),
)
const distance = this.position.clone().sub(fixedDest).length()