cutechicken commited on
Commit
cec0881
โ€ข
1 Parent(s): c4be236

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +12 -4
game.js CHANGED
@@ -11,7 +11,7 @@ const ENEMY_SCALE = 1;
11
  const MAX_HEALTH = 1000;
12
  const ENEMY_MOVE_SPEED = 0.1;
13
  const ENEMY_COUNT_MAX = 3;
14
- const PARTICLE_COUNT = 15;
15
  const BUILDING_COUNT = 30;
16
  const ENEMY_CONFIG = {
17
  ATTACK_RANGE: 100,
@@ -169,6 +169,11 @@ class TankPlayer {
169
  this.turretGroup.position.y = 0.2;
170
  this.turretGroup.add(this.turret);
171
  this.body.add(this.turretGroup);
 
 
 
 
 
172
 
173
  // ๊ทธ๋ฆผ์ž ์„ค์ •์€ ๊ทธ๋Œ€๋กœ ์œ ์ง€
174
  this.body.traverse((child) => {
@@ -645,6 +650,7 @@ class Enemy {
645
  this.mesh = result.scene;
646
  this.mesh.position.copy(this.position);
647
  this.mesh.scale.set(ENEMY_SCALE, ENEMY_SCALE, ENEMY_SCALE);
 
648
 
649
  this.mesh.traverse((child) => {
650
  if (child.isMesh) {
@@ -955,6 +961,8 @@ class Game {
955
  this.enemyLabels = new Map(); // ์  ๋ผ๋ฒจ์„ ์ถ”์ ํ•˜๊ธฐ ์œ„ํ•œ Map ์ถ”๊ฐ€
956
  this.raycaster = new THREE.Raycaster();
957
  this.crosshair = document.getElementById('crosshair');
 
 
958
  document.getElementById('gameContainer').appendChild(this.renderer.domElement);
959
 
960
 
@@ -1000,7 +1008,7 @@ class Game {
1000
 
1001
  // ๋ Œ๋”๋Ÿฌ ์„ค์ •
1002
  this.renderer.shadowMap.enabled = true;
1003
- this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
1004
  this.renderer.setPixelRatio(window.devicePixelRatio);
1005
 
1006
  // ์นด๋ฉ”๋ผ ์ดˆ๊ธฐ ์„ค์ •
@@ -1058,8 +1066,8 @@ class Game {
1058
  mainLight.castShadow = true;
1059
 
1060
  // ๊ทธ๋ฆผ์ž ์„ค์ •
1061
- mainLight.shadow.mapSize.width = 4096;
1062
- mainLight.shadow.mapSize.height = 4096;
1063
  mainLight.shadow.camera.near = 0.5;
1064
  mainLight.shadow.camera.far = MAP_SIZE * 2;
1065
  mainLight.shadow.camera.left = -MAP_SIZE;
 
11
  const MAX_HEALTH = 1000;
12
  const ENEMY_MOVE_SPEED = 0.1;
13
  const ENEMY_COUNT_MAX = 3;
14
+ const PARTICLE_COUNT = 5;
15
  const BUILDING_COUNT = 30;
16
  const ENEMY_CONFIG = {
17
  ATTACK_RANGE: 100,
 
169
  this.turretGroup.position.y = 0.2;
170
  this.turretGroup.add(this.turret);
171
  this.body.add(this.turretGroup);
172
+ // ํƒฑํฌ ์œ„์น˜ ๋†’์ด ์กฐ์ •
173
+ this.body.position.y = 1.5; // ๊ฐ’์„ ์กฐ์ •ํ•˜์—ฌ ์ ์ ˆํ•œ ๋†’์ด ์„ค์ •
174
+
175
+ // ๊ทธ๋ฆผ์ž ํ‰๋ฉด ์œ„์น˜๋„ ์กฐ์ •
176
+ this.shadowPlane.position.y = -1.0;
177
 
178
  // ๊ทธ๋ฆผ์ž ์„ค์ •์€ ๊ทธ๋Œ€๋กœ ์œ ์ง€
179
  this.body.traverse((child) => {
 
650
  this.mesh = result.scene;
651
  this.mesh.position.copy(this.position);
652
  this.mesh.scale.set(ENEMY_SCALE, ENEMY_SCALE, ENEMY_SCALE);
653
+ this.mesh.position.y = 1.5; // ์  ํƒฑํฌ๋„ ๊ฐ™์€ ๋†’์ด๋กœ ์กฐ์ •
654
 
655
  this.mesh.traverse((child) => {
656
  if (child.isMesh) {
 
961
  this.enemyLabels = new Map(); // ์  ๋ผ๋ฒจ์„ ์ถ”์ ํ•˜๊ธฐ ์œ„ํ•œ Map ์ถ”๊ฐ€
962
  this.raycaster = new THREE.Raycaster();
963
  this.crosshair = document.getElementById('crosshair');
964
+ // ์„ฑ๋Šฅ ๊ด€๋ จ ์„ค์ • ์ถ”๊ฐ€
965
+ this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); // ํ”ฝ์…€ ๋น„์œจ ์ œํ•œ
966
  document.getElementById('gameContainer').appendChild(this.renderer.domElement);
967
 
968
 
 
1008
 
1009
  // ๋ Œ๋”๋Ÿฌ ์„ค์ •
1010
  this.renderer.shadowMap.enabled = true;
1011
+ this.renderer.shadowMap.type = THREE.PCFShadowMap; // PCFSoftShadowMap์—์„œ ๋ณ€๊ฒฝ
1012
  this.renderer.setPixelRatio(window.devicePixelRatio);
1013
 
1014
  // ์นด๋ฉ”๋ผ ์ดˆ๊ธฐ ์„ค์ •
 
1066
  mainLight.castShadow = true;
1067
 
1068
  // ๊ทธ๋ฆผ์ž ์„ค์ •
1069
+ mainLight.shadow.mapSize.width = 2048; // 4096์—์„œ ์ถ•์†Œ
1070
+ mainLight.shadow.mapSize.height = 2048;
1071
  mainLight.shadow.camera.near = 0.5;
1072
  mainLight.shadow.camera.far = MAP_SIZE * 2;
1073
  mainLight.shadow.camera.left = -MAP_SIZE;