Spaces:
Running
Running
cutechicken
commited on
Commit
β’
ea69448
1
Parent(s):
27969e9
Update game.js
Browse files
game.js
CHANGED
@@ -850,6 +850,8 @@ class Game {
|
|
850 |
// κ²μ μμ μ¬λΆλ₯Ό μΆμ νλ νλκ·Έ μΆκ°
|
851 |
this.isStarted = false;
|
852 |
// μ€λμ€ κ΄λ ¨ μμ± μΆκ°
|
|
|
|
|
853 |
this.engineSound = null;
|
854 |
this.engineStopSound = null;
|
855 |
this.isEngineRunning = false;
|
@@ -924,11 +926,14 @@ class Game {
|
|
924 |
|
925 |
async initialize() {
|
926 |
try {
|
927 |
-
// BGM
|
928 |
-
this.
|
929 |
-
|
930 |
-
|
931 |
-
|
|
|
|
|
|
|
932 |
|
933 |
// μμ μ¬μ΄λ μ¬μ
|
934 |
const startSounds = ['sounds/start1.ogg', 'sounds/start2.ogg', 'sounds/start3.ogg'];
|
@@ -1722,6 +1727,12 @@ class Game {
|
|
1722 |
if (this.isGameOver) return;
|
1723 |
|
1724 |
this.isGameOver = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
1725 |
|
1726 |
// μ¬λ§ μ¬μ΄λ μ¬μ
|
1727 |
const deathSounds = ['sounds/death1.ogg', 'sounds/death2.ogg'];
|
|
|
850 |
// κ²μ μμ μ¬λΆλ₯Ό μΆμ νλ νλκ·Έ μΆκ°
|
851 |
this.isStarted = false;
|
852 |
// μ€λμ€ κ΄λ ¨ μμ± μΆκ°
|
853 |
+
this.bgmPlaying = false; // BGM μ¬μ μν μΆμ
|
854 |
+
this.bgm = null; // BGM μ€λμ€ κ°μ²΄ μ μ₯
|
855 |
this.engineSound = null;
|
856 |
this.engineStopSound = null;
|
857 |
this.isEngineRunning = false;
|
|
|
926 |
|
927 |
async initialize() {
|
928 |
try {
|
929 |
+
// BGMμ΄ μμ§ μ¬μλμ§ μμ κ²½μ°μλ§ μ¬μ
|
930 |
+
if (!this.bgmPlaying && !this.bgm) {
|
931 |
+
this.bgm = new Audio('sounds/BGM.ogg');
|
932 |
+
this.bgm.volume = 0.5;
|
933 |
+
this.bgm.loop = true;
|
934 |
+
this.bgm.play();
|
935 |
+
this.bgmPlaying = true;
|
936 |
+
}
|
937 |
|
938 |
// μμ μ¬μ΄λ μ¬μ
|
939 |
const startSounds = ['sounds/start1.ogg', 'sounds/start2.ogg', 'sounds/start3.ogg'];
|
|
|
1727 |
if (this.isGameOver) return;
|
1728 |
|
1729 |
this.isGameOver = true;
|
1730 |
+
// BGM μ μ§
|
1731 |
+
if (this.bgm) {
|
1732 |
+
this.bgm.pause();
|
1733 |
+
this.bgm = null;
|
1734 |
+
this.bgmPlaying = false;
|
1735 |
+
}
|
1736 |
|
1737 |
// μ¬λ§ μ¬μ΄λ μ¬μ
|
1738 |
const deathSounds = ['sounds/death1.ogg', 'sounds/death2.ogg'];
|