Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
|
@@ -609,7 +609,7 @@ class Fighter {
|
|
| 609 |
// ํํ ์ด๊ธฐ ์์น ์ ์ฅ
|
| 610 |
bullet.startPosition = bullet.position.clone();
|
| 611 |
|
| 612 |
-
const bulletSpeed = 1000
|
| 613 |
const direction = new THREE.Vector3(0, 0, 1);
|
| 614 |
direction.applyEuler(this.rotation);
|
| 615 |
bullet.velocity = direction.multiplyScalar(bulletSpeed);
|
|
@@ -617,39 +617,21 @@ class Fighter {
|
|
| 617 |
scene.add(bullet);
|
| 618 |
this.bullets.push(bullet);
|
| 619 |
|
| 620 |
-
// m134.ogg ์๋ฆฌ ์ฌ์ -
|
| 621 |
try {
|
| 622 |
-
|
| 623 |
-
|
| 624 |
|
| 625 |
-
//
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
// -2 ~ +2 ์ฌ์ด์ ๋๋ค ํผ์น (playbackRate๋ก ์๋ฎฌ๋ ์ด์
)
|
| 636 |
-
const randomPitch = 0.8 + Math.random() * 0.4; // 0.8 ~ 1.2 ๋ฒ์
|
| 637 |
-
audio.playbackRate = randomPitch;
|
| 638 |
-
|
| 639 |
-
source.connect(pitchShift);
|
| 640 |
-
pitchShift.connect(audioContext.destination);
|
| 641 |
-
|
| 642 |
-
audio.play().catch(e => console.log('Gunfire sound failed to play'));
|
| 643 |
-
this.gunfireAudios.push(audio);
|
| 644 |
-
|
| 645 |
-
// ์ฌ์ ์๋ฃ ์ ๋ฐฐ์ด์์ ์ ๊ฑฐ
|
| 646 |
-
audio.addEventListener('ended', () => {
|
| 647 |
-
const index = this.gunfireAudios.indexOf(audio);
|
| 648 |
-
if (index > -1) {
|
| 649 |
-
this.gunfireAudios.splice(index, 1);
|
| 650 |
-
}
|
| 651 |
-
});
|
| 652 |
-
}
|
| 653 |
} catch (e) {
|
| 654 |
console.log('Audio error:', e);
|
| 655 |
}
|
|
@@ -850,7 +832,7 @@ class EnemyFighter {
|
|
| 850 |
|
| 851 |
const direction = new THREE.Vector3(0, 0, 1);
|
| 852 |
direction.applyEuler(this.rotation);
|
| 853 |
-
bullet.velocity = direction.multiplyScalar(800)
|
| 854 |
|
| 855 |
this.scene.add(bullet);
|
| 856 |
this.bullets.push(bullet);
|
|
|
|
| 609 |
// ํํ ์ด๊ธฐ ์์น ์ ์ฅ
|
| 610 |
bullet.startPosition = bullet.position.clone();
|
| 611 |
|
| 612 |
+
const bulletSpeed = 1500; // 1000์์ 1500์ผ๋ก ์ฆ๊ฐ (50% ๋น ๋ฅด๊ฒ)
|
| 613 |
const direction = new THREE.Vector3(0, 0, 1);
|
| 614 |
direction.applyEuler(this.rotation);
|
| 615 |
bullet.velocity = direction.multiplyScalar(bulletSpeed);
|
|
|
|
| 617 |
scene.add(bullet);
|
| 618 |
this.bullets.push(bullet);
|
| 619 |
|
| 620 |
+
// m134.ogg ์๋ฆฌ ์ฌ์ - ์ค์ฒฉ ์ ํ ํด์ , ๋๋ค ํผ์น
|
| 621 |
try {
|
| 622 |
+
const audio = new Audio('sounds/m134.ogg');
|
| 623 |
+
audio.volume = 0.3;
|
| 624 |
|
| 625 |
+
// -2 ~ +2 ์ฌ์ด์ ๋๋ค ํผ์น (playbackRate๋ก ์๋ฎฌ๋ ์ด์
)
|
| 626 |
+
const randomPitch = 0.8 + Math.random() * 0.4; // 0.8 ~ 1.2 ๋ฒ์
|
| 627 |
+
audio.playbackRate = randomPitch;
|
| 628 |
+
|
| 629 |
+
audio.play().catch(e => console.log('Gunfire sound failed to play'));
|
| 630 |
+
|
| 631 |
+
// ์ฌ์ ์๋ฃ ์ ๋ฉ๋ชจ๋ฆฌ ์ ๋ฆฌ๋ฅผ ์ํด ์ฐธ์กฐ ์ ๊ฑฐ
|
| 632 |
+
audio.addEventListener('ended', () => {
|
| 633 |
+
audio.remove();
|
| 634 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
} catch (e) {
|
| 636 |
console.log('Audio error:', e);
|
| 637 |
}
|
|
|
|
| 832 |
|
| 833 |
const direction = new THREE.Vector3(0, 0, 1);
|
| 834 |
direction.applyEuler(this.rotation);
|
| 835 |
+
bullet.velocity = direction.multiplyScalar(1200); // 800์์ 1200์ผ๋ก ์ฆ๊ฐ (50% ๋น ๋ฅด๊ฒ)
|
| 836 |
|
| 837 |
this.scene.add(bullet);
|
| 838 |
this.bullets.push(bullet);
|