Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
|
@@ -4,7 +4,7 @@ import { PointerLockControls } from 'three/addons/controls/PointerLockControls.j
|
|
| 4 |
|
| 5 |
// ๊ฒ์ ์์
|
| 6 |
const GAME_DURATION = 180;
|
| 7 |
-
const MAP_SIZE =
|
| 8 |
const TANK_HEIGHT = 0.5;
|
| 9 |
const ENEMY_GROUND_HEIGHT = 0;
|
| 10 |
const ENEMY_SCALE = 1;
|
|
@@ -1079,23 +1079,26 @@ class Game {
|
|
| 1079 |
|
| 1080 |
// ๋์ ๋งต ๋ก๋
|
| 1081 |
try {
|
| 1082 |
-
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
} catch (error) {
|
| 1097 |
-
console.error('Error loading city map:', error);
|
| 1098 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1099 |
|
| 1100 |
// ํฑํฌ ์ด๊ธฐํ
|
| 1101 |
await this.tank.initialize(this.scene, this.loader);
|
|
|
|
| 4 |
|
| 5 |
// ๊ฒ์ ์์
|
| 6 |
const GAME_DURATION = 180;
|
| 7 |
+
const MAP_SIZE = 400;
|
| 8 |
const TANK_HEIGHT = 0.5;
|
| 9 |
const ENEMY_GROUND_HEIGHT = 0;
|
| 10 |
const ENEMY_SCALE = 1;
|
|
|
|
| 1079 |
|
| 1080 |
// ๋์ ๋งต ๋ก๋
|
| 1081 |
try {
|
| 1082 |
+
const cityMap = await this.loader.loadAsync('/models/map.glb');
|
| 1083 |
+
cityMap.scene.scale.set(3, 3, 3); // ์ค์ผ์ผ์ 3๋ฐฐ๋ก ์ฆ๊ฐ
|
| 1084 |
+
cityMap.scene.traverse((child) => {
|
| 1085 |
+
if (child.isMesh) {
|
| 1086 |
+
child.castShadow = true;
|
| 1087 |
+
child.receiveShadow = true;
|
| 1088 |
+
child.material.needsUpdate = true;
|
| 1089 |
+
|
| 1090 |
+
// ์ถฉ๋ ์ฒ๋ฆฌ๋ฅผ ์ํด obstacles ๋ฐฐ์ด์ ์ถ๊ฐ
|
| 1091 |
+
if (child.geometry) {
|
| 1092 |
+
// ์ค์ผ์ผ์ด ์ ์ฉ๋ ์ํ๋ก ์ถฉ๋ ๋ฐ์ค ์์ฑ
|
| 1093 |
+
child.geometry.computeBoundingBox();
|
| 1094 |
+
this.obstacles.push(child);
|
| 1095 |
+
}
|
|
|
|
|
|
|
| 1096 |
}
|
| 1097 |
+
});
|
| 1098 |
+
this.scene.add(cityMap.scene);
|
| 1099 |
+
} catch (error) {
|
| 1100 |
+
console.error('Error loading city map:', error);
|
| 1101 |
+
}
|
| 1102 |
|
| 1103 |
// ํฑํฌ ์ด๊ธฐํ
|
| 1104 |
await this.tank.initialize(this.scene, this.loader);
|