cutechicken commited on
Commit
be5d96a
โ€ข
1 Parent(s): cd26316

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +37 -19
game.js CHANGED
@@ -585,38 +585,38 @@ class Enemy {
585
 
586
  const flashGroup = new THREE.Group();
587
 
588
- // ํ™”์—ผ ํšจ๊ณผ
589
- const flameGeometry = new THREE.SphereGeometry(0.5, 8, 8);
590
  const flameMaterial = new THREE.MeshBasicMaterial({
591
- color: 0xff4500,
592
  transparent: true,
593
  opacity: 0.8
594
  });
595
  const flame = new THREE.Mesh(flameGeometry, flameMaterial);
596
- flame.scale.set(1.5, 1.5, 2);
597
  flashGroup.add(flame);
598
 
599
- // ์—ฐ๊ธฐ ํšจ๊ณผ
600
- const smokeGeometry = new THREE.SphereGeometry(0.4, 8, 8);
601
  const smokeMaterial = new THREE.MeshBasicMaterial({
602
- color: 0x444444,
603
  transparent: true,
604
- opacity: 0.4
605
  });
606
 
607
- for (let i = 0; i < 3; i++) {
608
  const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
609
  smoke.position.set(
610
- Math.random() * 0.5 - 0.25,
611
- Math.random() * 0.5 - 0.25,
612
- -0.5 - Math.random()
613
  );
614
- smoke.scale.set(1, 1, 1);
615
  flashGroup.add(smoke);
616
  }
617
 
618
  // ํฌ๊ตฌ ์œ„์น˜ ๊ณ„์‚ฐ
619
- const muzzleOffset = new THREE.Vector3(0, 0.5, 3);
620
  const muzzlePosition = new THREE.Vector3();
621
  const meshWorldQuaternion = new THREE.Quaternion();
622
 
@@ -631,10 +631,10 @@ class Enemy {
631
 
632
  this.scene.add(flashGroup);
633
 
634
- // ์ดํŽ™ํŠธ ์ œ๊ฑฐ
635
  setTimeout(() => {
636
  this.scene.remove(flashGroup);
637
- }, 100);
638
  }
639
 
640
 
@@ -838,14 +838,17 @@ class Enemy {
838
  enemyFireSound.volume = 0.3;
839
  enemyFireSound.play();
840
 
841
- const bulletGeometry = new THREE.SphereGeometry(this.type === 'tank' ? 0.2 : 0.3);
 
842
  const bulletMaterial = new THREE.MeshBasicMaterial({
843
- color: this.type === 'tank' ? 0xff0000 : 0xff6600
 
 
844
  });
845
  const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
846
 
847
  // ํฌ๊ตฌ ์œ„์น˜์—์„œ ๋ฐœ์‚ฌ
848
- const muzzleOffset = new THREE.Vector3(0, 0.5, 3);
849
  const muzzlePosition = new THREE.Vector3();
850
  this.mesh.getWorldPosition(muzzlePosition);
851
  muzzleOffset.applyQuaternion(this.mesh.quaternion);
@@ -853,6 +856,9 @@ class Enemy {
853
 
854
  bullet.position.copy(muzzlePosition);
855
 
 
 
 
856
  const direction = new THREE.Vector3()
857
  .subVectors(playerPosition, muzzlePosition)
858
  .normalize();
@@ -863,6 +869,18 @@ class Enemy {
863
 
864
  bullet.velocity = direction.multiplyScalar(bulletSpeed);
865
 
 
 
 
 
 
 
 
 
 
 
 
 
866
  this.scene.add(bullet);
867
  this.bullets.push(bullet);
868
  this.lastAttackTime = currentTime;
 
585
 
586
  const flashGroup = new THREE.Group();
587
 
588
+ // ํ™”์—ผ ํฌ๊ธฐ ์ฆ๊ฐ€ ๋ฐ ์ƒ‰์ƒ ๋ณ€๊ฒฝ
589
+ const flameGeometry = new THREE.SphereGeometry(1.0, 8, 8);
590
  const flameMaterial = new THREE.MeshBasicMaterial({
591
+ color: 0xffa500, // ๋…ธ๋ž€์ƒ‰์œผ๋กœ ๋ณ€๊ฒฝ
592
  transparent: true,
593
  opacity: 0.8
594
  });
595
  const flame = new THREE.Mesh(flameGeometry, flameMaterial);
596
+ flame.scale.set(2, 2, 3);
597
  flashGroup.add(flame);
598
 
599
+ // ์—ฐ๊ธฐ ํšจ๊ณผ ํฌ๊ธฐ ์ฆ๊ฐ€
600
+ const smokeGeometry = new THREE.SphereGeometry(0.8, 8, 8);
601
  const smokeMaterial = new THREE.MeshBasicMaterial({
602
+ color: 0x555555,
603
  transparent: true,
604
+ opacity: 0.5
605
  });
606
 
607
+ for (let i = 0; i < 5; i++) {
608
  const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
609
  smoke.position.set(
610
+ Math.random() * 1 - 0.5,
611
+ Math.random() * 1 - 0.5,
612
+ -1 - Math.random()
613
  );
614
+ smoke.scale.set(1.5, 1.5, 1.5);
615
  flashGroup.add(smoke);
616
  }
617
 
618
  // ํฌ๊ตฌ ์œ„์น˜ ๊ณ„์‚ฐ
619
+ const muzzleOffset = new THREE.Vector3(0, 0.5, 4);
620
  const muzzlePosition = new THREE.Vector3();
621
  const meshWorldQuaternion = new THREE.Quaternion();
622
 
 
631
 
632
  this.scene.add(flashGroup);
633
 
634
+ // ์ดํŽ™ํŠธ ์ง€์† ์‹œ๊ฐ„ ์ฆ๊ฐ€
635
  setTimeout(() => {
636
  this.scene.remove(flashGroup);
637
+ }, 500);
638
  }
639
 
640
 
 
838
  enemyFireSound.volume = 0.3;
839
  enemyFireSound.play();
840
 
841
+ // ํฌํƒ„ ์ƒ์„ฑ (ํ”Œ๋ ˆ์ด์–ด์™€ ์œ ์‚ฌํ•˜๊ฒŒ ์ˆ˜์ •)
842
+ const bulletGeometry = new THREE.CylinderGeometry(0.2, 0.2, 2, 8);
843
  const bulletMaterial = new THREE.MeshBasicMaterial({
844
+ color: 0xff0000, // ๋นจ๊ฐ„์ƒ‰ ํฌํƒ„
845
+ emissive: 0xff0000,
846
+ emissiveIntensity: 0.5
847
  });
848
  const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
849
 
850
  // ํฌ๊ตฌ ์œ„์น˜์—์„œ ๋ฐœ์‚ฌ
851
+ const muzzleOffset = new THREE.Vector3(0, 0.5, 4);
852
  const muzzlePosition = new THREE.Vector3();
853
  this.mesh.getWorldPosition(muzzlePosition);
854
  muzzleOffset.applyQuaternion(this.mesh.quaternion);
 
856
 
857
  bullet.position.copy(muzzlePosition);
858
 
859
+ // ํฌํƒ„ ํšŒ์ „ ์„ค์ •
860
+ bullet.quaternion.copy(this.mesh.quaternion);
861
+
862
  const direction = new THREE.Vector3()
863
  .subVectors(playerPosition, muzzlePosition)
864
  .normalize();
 
869
 
870
  bullet.velocity = direction.multiplyScalar(bulletSpeed);
871
 
872
+ // ํฌํƒ„ ํŠธ๋ ˆ์ผ ํšจ๊ณผ ์ถ”๊ฐ€
873
+ const trailGeometry = new THREE.CylinderGeometry(0.1, 0.1, 1, 8);
874
+ const trailMaterial = new THREE.MeshBasicMaterial({
875
+ color: 0xff4444,
876
+ transparent: true,
877
+ opacity: 0.5
878
+ });
879
+
880
+ const trail = new THREE.Mesh(trailGeometry, trailMaterial);
881
+ trail.position.z = -1;
882
+ bullet.add(trail);
883
+
884
  this.scene.add(bullet);
885
  this.bullets.push(bullet);
886
  this.lastAttackTime = currentTime;