cutechicken commited on
Commit
0e11cb1
β€’
1 Parent(s): e9310dc

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +41 -41
game.js CHANGED
@@ -150,50 +150,50 @@ class TankPlayer {
150
  }
151
 
152
  createMuzzleFlash(scene) {
153
- const flashGroup = new THREE.Group();
154
-
155
- // ν™”μ—Ό 생성
156
- const flameGeometry = new THREE.SphereGeometry(0.5, 8, 8);
157
- const flameMaterial = new THREE.MeshBasicMaterial({
158
- color: 0xffa500,
159
- transparent: true,
160
- opacity: 0.8
161
- });
162
- const flame = new THREE.Mesh(flameGeometry, flameMaterial);
163
- flame.scale.set(1.5, 1.5, 2);
164
- flashGroup.add(flame);
165
-
166
- // μ—°κΈ° 생성
167
- const smokeGeometry = new THREE.SphereGeometry(0.3, 8, 8);
168
- const smokeMaterial = new THREE.MeshBasicMaterial({
169
- color: 0x555555,
170
- transparent: true,
171
- opacity: 0.5
172
- });
173
- for (let i = 0; i < 3; i++) {
174
- const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
175
- smoke.position.set(
176
- Math.random() * 0.5 - 0.25,
177
- Math.random() * 0.5 - 0.25,
178
- -0.5 - Math.random() * 0.5
179
- );
180
- flashGroup.add(smoke);
181
- }
182
 
183
- // μœ„μΉ˜ μ„€μ • (포탑 끝)
184
- const muzzlePosition = new THREE.Vector3(0, 0.5, 2);
185
- muzzlePosition.applyQuaternion(this.turretGroup.quaternion);
186
- muzzlePosition.applyQuaternion(this.body.quaternion);
187
- flashGroup.position.copy(this.body.position).add(muzzlePosition);
188
 
189
- // 씬에 μΆ”κ°€
190
- scene.add(flashGroup);
 
 
 
 
 
 
191
 
192
- // 일정 μ‹œκ°„ ν›„ 제거
193
- setTimeout(() => {
194
- scene.remove(flashGroup);
195
- }, 300); // 300ms μœ μ§€
196
- }
197
 
198
 
199
  createBullet(scene) {
 
150
  }
151
 
152
  createMuzzleFlash(scene) {
153
+ const flashGroup = new THREE.Group();
154
+
155
+ // ν™”μ—Ό 생성
156
+ const flameGeometry = new THREE.SphereGeometry(0.5, 8, 8);
157
+ const flameMaterial = new THREE.MeshBasicMaterial({
158
+ color: 0xffa500,
159
+ transparent: true,
160
+ opacity: 0.8
161
+ });
162
+ const flame = new THREE.Mesh(flameGeometry, flameMaterial);
163
+ flame.scale.set(1.5, 1.5, 2);
164
+ flashGroup.add(flame);
165
+
166
+ // μ—°κΈ° 생성
167
+ const smokeGeometry = new THREE.SphereGeometry(0.3, 8, 8);
168
+ const smokeMaterial = new THREE.MeshBasicMaterial({
169
+ color: 0x555555,
170
+ transparent: true,
171
+ opacity: 0.5
172
+ });
173
+ for (let i = 0; i < 3; i++) {
174
+ const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
175
+ smoke.position.set(
176
+ Math.random() * 0.5 - 0.25,
177
+ Math.random() * 0.5 - 0.25,
178
+ -0.5 - Math.random() * 0.5
179
+ );
180
+ flashGroup.add(smoke);
181
+ }
182
 
183
+ // μœ„μΉ˜ μ„€μ • (포탑 끝)
184
+ const muzzlePosition = new THREE.Vector3(0, 0, 2); // 포탑 끝 μƒλŒ€ μ’Œν‘œ
185
+ this.turret.getWorldPosition(muzzlePosition); // 포탑 끝의 μ „μ—­ μ’Œν‘œ 계산
186
+ flashGroup.position.copy(muzzlePosition);
 
187
 
188
+ // 씬에 μΆ”κ°€
189
+ scene.add(flashGroup);
190
+
191
+ // 일정 μ‹œκ°„ ν›„ 제거
192
+ setTimeout(() => {
193
+ scene.remove(flashGroup);
194
+ }, 300); // 300ms μœ μ§€
195
+ }
196
 
 
 
 
 
 
197
 
198
 
199
  createBullet(scene) {