Spaces:
Running
Running
cutechicken
commited on
Commit
โข
cec0881
1
Parent(s):
c4be236
Update game.js
Browse files
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 |
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 =
|
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;
|