Spaces:
Running
Running
cutechicken
commited on
Commit
โข
e239318
1
Parent(s):
6d9fb2e
Update game.js
Browse files
game.js
CHANGED
@@ -331,48 +331,39 @@ class Game {
|
|
331 |
this.scene.background = new THREE.Color(0x87CEEB);
|
332 |
|
333 |
// ์ฃผ๋ณ๊ด ์ค์ - ๋ ๋ฐ๊ฒ
|
334 |
-
const ambientLight = new THREE.AmbientLight(0xffffff,
|
335 |
this.scene.add(ambientLight);
|
336 |
|
337 |
-
// ํ์๊ด ์ค์
|
338 |
-
const directionalLight = new THREE.DirectionalLight(0xffffff,
|
339 |
directionalLight.position.set(100, 100, 50);
|
340 |
directionalLight.castShadow = true;
|
341 |
-
directionalLight.shadow.mapSize.width = 1024;
|
342 |
directionalLight.shadow.mapSize.height = 1024;
|
343 |
-
directionalLight.shadow.camera.near = 0.5;
|
344 |
-
directionalLight.shadow.camera.far = 500;
|
345 |
-
directionalLight.shadow.bias = -0.001;
|
346 |
this.scene.add(directionalLight);
|
347 |
|
348 |
-
// ์ฌ๋ง ์งํ ์์ฑ
|
349 |
-
const groundGeometry = new THREE.PlaneGeometry(MAP_SIZE, MAP_SIZE, 100, 100);
|
350 |
-
const
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
// ์ฌ๋ง ์ฌ์ง์ MeshBasicMaterial๋ก ๋ณ๊ฒฝ
|
355 |
-
const groundMaterial = new THREE.MeshBasicMaterial({
|
356 |
-
map: groundTexture,
|
357 |
-
color: 0xDEB887 // ๋ ๋ฐ์ ๋ฒ ์ด์ง์
|
358 |
});
|
359 |
|
360 |
const ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
361 |
ground.rotation.x = -Math.PI / 2;
|
362 |
-
ground.receiveShadow =
|
363 |
|
364 |
// ์งํ์ ๊ธฐ๋ณต ์ถ๊ฐ (๋จ์ํ)
|
365 |
const vertices = ground.geometry.attributes.position.array;
|
366 |
let seed = Math.random() * 100;
|
367 |
for (let i = 0; i < vertices.length; i += 3) {
|
368 |
-
|
369 |
-
const y = vertices[i + 1] / 100;
|
370 |
-
vertices[i + 2] =
|
371 |
-
(Math.sin(x + seed) * Math.cos(y + seed) * 1.0);
|
372 |
}
|
|
|
373 |
ground.geometry.attributes.position.needsUpdate = true;
|
374 |
ground.geometry.computeVertexNormals();
|
375 |
-
|
376 |
this.scene.add(ground);
|
377 |
|
378 |
// ๋๋จธ์ง ์ด๊ธฐํ ์ฝ๋
|
@@ -390,10 +381,10 @@ class Game {
|
|
390 |
tankPosition.z - 30
|
391 |
);
|
392 |
this.camera.lookAt(tankPosition);
|
393 |
-
|
394 |
this.isLoading = false;
|
395 |
document.getElementById('loading').style.display = 'none';
|
396 |
-
|
397 |
this.animate();
|
398 |
this.spawnEnemies();
|
399 |
this.startGameTimer();
|
|
|
331 |
this.scene.background = new THREE.Color(0x87CEEB);
|
332 |
|
333 |
// ์ฃผ๋ณ๊ด ์ค์ - ๋ ๋ฐ๊ฒ
|
334 |
+
const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
|
335 |
this.scene.add(ambientLight);
|
336 |
|
337 |
+
// ํ์๊ด ์ค์
|
338 |
+
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
|
339 |
directionalLight.position.set(100, 100, 50);
|
340 |
directionalLight.castShadow = true;
|
341 |
+
directionalLight.shadow.mapSize.width = 1024;
|
342 |
directionalLight.shadow.mapSize.height = 1024;
|
|
|
|
|
|
|
343 |
this.scene.add(directionalLight);
|
344 |
|
345 |
+
// ์ฌ๋ง ์งํ ์์ฑ (ํฌ๋ฆฌ์ฝฅํฐ ๊ฒ์ ์คํ์ผ)
|
346 |
+
const groundGeometry = new THREE.PlaneGeometry(MAP_SIZE, MAP_SIZE, 100, 100);
|
347 |
+
const groundMaterial = new THREE.MeshStandardMaterial({
|
348 |
+
color: 0xD2B48C,
|
349 |
+
roughness: 0.8,
|
350 |
+
metalness: 0.2
|
|
|
|
|
|
|
|
|
351 |
});
|
352 |
|
353 |
const ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
354 |
ground.rotation.x = -Math.PI / 2;
|
355 |
+
ground.receiveShadow = true;
|
356 |
|
357 |
// ์งํ์ ๊ธฐ๋ณต ์ถ๊ฐ (๋จ์ํ)
|
358 |
const vertices = ground.geometry.attributes.position.array;
|
359 |
let seed = Math.random() * 100;
|
360 |
for (let i = 0; i < vertices.length; i += 3) {
|
361 |
+
vertices[i + 2] = Math.sin(vertices[i] * 0.01) * Math.cos(vertices[i + 1] * 0.01) * 20;
|
|
|
|
|
|
|
362 |
}
|
363 |
+
|
364 |
ground.geometry.attributes.position.needsUpdate = true;
|
365 |
ground.geometry.computeVertexNormals();
|
366 |
+
|
367 |
this.scene.add(ground);
|
368 |
|
369 |
// ๋๋จธ์ง ์ด๊ธฐํ ์ฝ๋
|
|
|
381 |
tankPosition.z - 30
|
382 |
);
|
383 |
this.camera.lookAt(tankPosition);
|
384 |
+
|
385 |
this.isLoading = false;
|
386 |
document.getElementById('loading').style.display = 'none';
|
387 |
+
|
388 |
this.animate();
|
389 |
this.spawnEnemies();
|
390 |
this.startGameTimer();
|