Lashtw commited on
Commit
b95f339
·
verified ·
1 Parent(s): 9aa367b

Upload 8 files

Browse files
Files changed (4) hide show
  1. README.md +5 -4
  2. audio_controller.js +4 -7
  3. images/Loss.jpg +2 -2
  4. images/king.jpg +2 -2
README.md CHANGED
@@ -71,10 +71,11 @@ license: mit
71
 
72
  ## 🎵 音效說明
73
 
74
- 遊戲包含背景音樂和音效系統:
75
- - 背景音樂:Cjbeards - Fire and Thunder
76
- - 音樂提供:J&B 無版權音樂庫
77
- - 可透過右下角按鈕控制音樂開關
 
78
 
79
  ## 🔒 隱私說明
80
 
 
71
 
72
  ## 🎵 音效說明
73
 
74
+ 遊戲包含完整的背景音樂和音效系統:
75
+ - **背景音樂**:BGM.mp3(已包含在部署包中)
76
+ - **音樂控制**:可透過右下角按鈕控制音樂開關
77
+ - **自動播放**:遊戲開始時會嘗試播放背景音樂
78
+ - **瀏覽器限制**:部分瀏覽器可能需要用戶互動後才能播放音樂
79
 
80
  ## 🔒 隱私說明
81
 
audio_controller.js CHANGED
@@ -13,18 +13,15 @@ const audioController = {
13
  console.log('音效控制器初始化中...');
14
 
15
  // 初始化背景音樂
16
- // 注意:由於版權考量,這裡不包含實際的音樂檔案
17
- // 如果要添加背景音樂,請取消註解以下代碼並提供音樂檔案
18
- /*
19
  try {
20
- this.bgm = new Audio('audio/background.mp3');
21
  this.bgm.loop = true;
22
  this.bgm.volume = 0.3;
23
  this.bgm.preload = 'auto';
 
24
  } catch (error) {
25
  console.log('背景音樂載入失敗:', error);
26
  }
27
- */
28
 
29
  // 初始化攻擊音效
30
  // 同樣由於版權考量,這裡不包含實際的音效檔案
@@ -80,7 +77,7 @@ const audioController = {
80
  if (playPromise !== undefined) {
81
  playPromise.then(() => {
82
  this.isBGMPlaying = true;
83
- console.log('背景音樂開始播放');
84
  }).catch(error => {
85
  console.log('背景音樂播放失敗:', error);
86
  // 瀏覽器可能阻止自動播放,這是正常的
@@ -103,7 +100,7 @@ const audioController = {
103
  // 切換背景音樂
104
  toggleBGM() {
105
  if (!this.bgm) {
106
- console.log('背景音樂功能暫時不可用');
107
  return;
108
  }
109
 
 
13
  console.log('音效控制器初始化中...');
14
 
15
  // 初始化背景音樂
 
 
 
16
  try {
17
+ this.bgm = new Audio('BGM.mp3');
18
  this.bgm.loop = true;
19
  this.bgm.volume = 0.3;
20
  this.bgm.preload = 'auto';
21
+ console.log('背景音樂已載入: BGM.mp3');
22
  } catch (error) {
23
  console.log('背景音樂載入失敗:', error);
24
  }
 
25
 
26
  // 初始化攻擊音效
27
  // 同樣由於版權考量,這裡不包含實際的音效檔案
 
77
  if (playPromise !== undefined) {
78
  playPromise.then(() => {
79
  this.isBGMPlaying = true;
80
+ console.log('背景音樂開始播放: BGM.mp3');
81
  }).catch(error => {
82
  console.log('背景音樂播放失敗:', error);
83
  // 瀏覽器可能阻止自動播放,這是正常的
 
100
  // 切換背景音樂
101
  toggleBGM() {
102
  if (!this.bgm) {
103
+ console.log('背景音樂功能已載入,但可能因瀏覽器限制無法自動播放');
104
  return;
105
  }
106
 
images/Loss.jpg CHANGED

Git LFS Details

  • SHA256: 03a169c5cdedbfdbd8f07b4aea6631c1d1cd876d6be3c6c0d801118aa8fb2849
  • Pointer size: 131 Bytes
  • Size of remote file: 583 kB

Git LFS Details

  • SHA256: 1fbb96e5fa187d03f86950f430dc923c0a025707b337d836b2a3a84727a0b01c
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB
images/king.jpg CHANGED

Git LFS Details

  • SHA256: edb42723b18441c422e175561da6b865897ccb1b783abefe254e1651f3f970d3
  • Pointer size: 131 Bytes
  • Size of remote file: 924 kB

Git LFS Details

  • SHA256: e1f9ea1213eacc34394357c484231e0a9f3b97c69a0ed84587508c0e1dfe0c55
  • Pointer size: 132 Bytes
  • Size of remote file: 1.37 MB