Spaces:
Running
Running
Update game.js
Browse files
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
|
| 590 |
const flameMaterial = new THREE.MeshBasicMaterial({
|
| 591 |
-
color:
|
| 592 |
transparent: true,
|
| 593 |
opacity: 0.8
|
| 594 |
});
|
| 595 |
const flame = new THREE.Mesh(flameGeometry, flameMaterial);
|
| 596 |
-
flame.scale.set(
|
| 597 |
flashGroup.add(flame);
|
| 598 |
|
| 599 |
-
// ์ฐ๊ธฐ ํจ๊ณผ
|
| 600 |
-
const smokeGeometry = new THREE.SphereGeometry(0.
|
| 601 |
const smokeMaterial = new THREE.MeshBasicMaterial({
|
| 602 |
-
color:
|
| 603 |
transparent: true,
|
| 604 |
-
opacity: 0.
|
| 605 |
});
|
| 606 |
|
| 607 |
-
for (let i = 0; i <
|
| 608 |
const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
|
| 609 |
smoke.position.set(
|
| 610 |
-
Math.random() *
|
| 611 |
-
Math.random() *
|
| 612 |
-
-
|
| 613 |
);
|
| 614 |
-
smoke.scale.set(1, 1, 1);
|
| 615 |
flashGroup.add(smoke);
|
| 616 |
}
|
| 617 |
|
| 618 |
// ํฌ๊ตฌ ์์น ๊ณ์ฐ
|
| 619 |
-
const muzzleOffset = new THREE.Vector3(0, 0.5,
|
| 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 |
-
},
|
| 638 |
}
|
| 639 |
|
| 640 |
|
|
@@ -838,14 +838,17 @@ class Enemy {
|
|
| 838 |
enemyFireSound.volume = 0.3;
|
| 839 |
enemyFireSound.play();
|
| 840 |
|
| 841 |
-
|
|
|
|
| 842 |
const bulletMaterial = new THREE.MeshBasicMaterial({
|
| 843 |
-
color:
|
|
|
|
|
|
|
| 844 |
});
|
| 845 |
const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
|
| 846 |
|
| 847 |
// ํฌ๊ตฌ ์์น์์ ๋ฐ์ฌ
|
| 848 |
-
const muzzleOffset = new THREE.Vector3(0, 0.5,
|
| 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;
|