cutechicken commited on
Commit
7ef646a
ยท
verified ยท
1 Parent(s): 5153a18

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +1 -45
game.js CHANGED
@@ -42,12 +42,6 @@ class TankPlayer {
42
  this.scene = new THREE.Scene();
43
  this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
44
  this.renderer = new THREE.WebGLRenderer({ antialias: true });
45
- this.cameraShake = {
46
- active: false,
47
- intensity: 0,
48
- duration: 0,
49
- time: 0,
50
- originalPosition: null
51
  }
52
  // ๋ณ„๋„์˜ ๋ฉ”์„œ๋“œ๋กœ ๋ถ„๋ฆฌ
53
  createExplosionEffect(scene, position) {
@@ -309,42 +303,8 @@ class TankPlayer {
309
  this.startReload();
310
  }
311
  }
312
- // ์นด๋ฉ”๋ผ ํ”๋“ค๋ฆผ ํšจ๊ณผ ์ถ”๊ฐ€
313
- this.applyCameraShake();
314
  return bullet;
315
  }
316
- applyCameraShake() {
317
- if (!this.cameraShake || !this.cameraShake.active) return;
318
-
319
- const camera = window.gameInstance.camera;
320
- if (!camera) return;
321
-
322
- // ์›๋ณธ ์œ„์น˜ ์ €์žฅ
323
- if (!this.cameraShake.originalPosition) {
324
- this.cameraShake.originalPosition = camera.position.clone();
325
- }
326
-
327
- // ์‹œ๊ฐ„ ์—…๋ฐ์ดํŠธ
328
- this.cameraShake.time += 16; // ์•ฝ 60fps ๊ธฐ์ค€
329
-
330
- // ๊ฐ์‡  ๊ณ„์ˆ˜ ๊ณ„์‚ฐ (์‹œ๊ฐ„์ด ์ง€๋‚ ์ˆ˜๋ก ํ”๋“ค๋ฆผ์ด ์ค„์–ด๋“ฆ)
331
- const damping = 1 - (this.cameraShake.time / this.cameraShake.duration);
332
-
333
- if (this.cameraShake.time < this.cameraShake.duration) {
334
- // ๋žœ๋คํ•œ ์˜คํ”„์…‹ ์ ์šฉ
335
- camera.position.x = this.cameraShake.originalPosition.x +
336
- (Math.random() - 0.5) * this.cameraShake.intensity * damping;
337
- camera.position.y = this.cameraShake.originalPosition.y +
338
- (Math.random() - 0.5) * this.cameraShake.intensity * damping;
339
- camera.position.z = this.cameraShake.originalPosition.z +
340
- (Math.random() - 0.5) * this.cameraShake.intensity * damping;
341
- } else {
342
- // ํšจ๊ณผ ์ข…๋ฃŒ
343
- camera.position.copy(this.cameraShake.originalPosition);
344
- this.cameraShake.active = false;
345
- this.cameraShake.originalPosition = null;
346
- }
347
- }
348
 
349
  startReload() {
350
  if (this.isReloading) return; // ์ด๋ฏธ ์žฌ์žฅ์ „ ์ค‘์ด๋ฉด ๋ฌด์‹œ
@@ -2661,11 +2621,7 @@ updateCrosshair() {
2661
  if (!this.isLoading) {
2662
  this.handleMovement();
2663
  this.tank.update(this.mouse.x, this.mouse.y, this.scene);
2664
-
2665
- // ์นด๋ฉ”๋ผ ํ”๋“ค๋ฆผ ํšจ๊ณผ ์—…๋ฐ์ดํŠธ
2666
- if (this.tank.cameraShake && this.tank.cameraShake.active) {
2667
- this.tank.applyCameraShake();
2668
- }
2669
  const tankPosition = this.tank.getPosition();
2670
  this.enemies.forEach(enemy => {
2671
  enemy.update(tankPosition);
 
42
  this.scene = new THREE.Scene();
43
  this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
44
  this.renderer = new THREE.WebGLRenderer({ antialias: true });
 
 
 
 
 
 
45
  }
46
  // ๋ณ„๋„์˜ ๋ฉ”์„œ๋“œ๋กœ ๋ถ„๋ฆฌ
47
  createExplosionEffect(scene, position) {
 
303
  this.startReload();
304
  }
305
  }
 
 
306
  return bullet;
307
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
 
309
  startReload() {
310
  if (this.isReloading) return; // ์ด๋ฏธ ์žฌ์žฅ์ „ ์ค‘์ด๋ฉด ๋ฌด์‹œ
 
2621
  if (!this.isLoading) {
2622
  this.handleMovement();
2623
  this.tank.update(this.mouse.x, this.mouse.y, this.scene);
2624
+
 
 
 
 
2625
  const tankPosition = this.tank.getPosition();
2626
  this.enemies.forEach(enemy => {
2627
  enemy.update(tankPosition);