#====================================================== # BGS遠近音量控制效果 by 解凍豬腳 #------------------------------------------------------ # MaxVolume : BGS最大音量 # Reduce : 距離音量差值 # Mute : 靜音範圍(離事件>=Mute則音量會被降到最小) #====================================================== MaxVolume = 100 Reduce = 8 Mute = 7 class Game_Event < Game_Character attr_reader :name attr_reader :erased alias tubobo_initialize initialize def initialize(map_id, event) tubobo_initialize(map_id, event) @name = @event.name end end class Scene_Map alias tubobo_bgs update def update tubobo_bgs plx = $game_player.x ply = $game_player.y for event in $game_map.events.values if event.name.length > 5 if event.name[0,5].downcase == "@bgs=" evx = event.x evy = event.y len = Math.hypot(plx-evx,ply-evy) bgs = event.name[5,event.name.length-5] bgsvolume = MaxVolume if len <= Mute * 0.1 and len < Mute * 0.2 bgsvolume -= Reduce * 0.5 elsif len <= Mute * 0.2 and len < Mute * 0.3 bgsvolume -= Reduce * 1.0 elsif len <= Mute * 0.3 and len < Mute * 0.4 bgsvolume -= Reduce * 1.7 elsif len <= Mute * 0.4 and len < Mute * 0.5 bgsvolume -= Reduce * 2.2 elsif len <= Mute * 0.5 and len < Mute * 0.6 bgsvolume -= Reduce * 2.7 elsif len <= Mute * 0.6 and len < Mute * 0.7 bgsvolume -= Reduce * 3.3 elsif len <= Mute * 0.7 and len < Mute * 0.8 bgsvolume -= Reduce * 3.8 elsif len <= Mute * 0.8 and len < Mute * 0.9 bgsvolume -= Reduce * 4.3 elsif len <= Mute * 0.9 and len < Mute * 1.0 bgsvolume -= Reduce * 4.9 else bgsvolume = 0 end if bgsvolume > 0 Audio.bgs_play("Audio/BGS/" + bgs, bgsvolume, 100) elsif bgsvolume < 0 Audio.bgs_play("Audio/BGS/" + bgs, 1, 100) end end end end end end class Game_Map alias tubobo_atp autoplay def autoplay Audio.bgs_stop tubobo_atp end end |
MaxVolume:這個是離物件最近時所播放的BGS音量。 Reduce:距離音量差值-- 這個比較難解釋,總之調高了,每遠離物件(音量降低一次)的降低量會提升; 反之則降低量會變小。 Mute:假設這個變數的值是N。這個值越大,每次的音效降低量會越小(與Reduce相反); 另外只要你和該物件的距離不小於N,音量就會被降到某個程度而不再改變。 |
同標籤作品搜尋:RPG|RM|RPG Maker|RPG Maker XP|RMXP|遊戲|RPG 製作大師|程式|RGSS
留言共 0 篇留言
前一篇:【RGSS/Ruby】看... 後一篇:【RGSS/Ruby】防...
豬腳生活 (1)
└日常雜談、巴哈大小事 (193)
└煞氣a國中生 (7)
└高中生活日誌 (55)
└大學生活日誌 (34)
└冬令營回憶錄 (19)
└也許藏有一些小祕密吧? (3)
└各式各樣的開箱文 (11)
└貓科動物時間 (15)
繪圖創作 (1)
└電繪插圖、草稿 (199)
└短篇漫畫、單幅標語 (61)
└上課太無聊的手繪塗鴉 (8)
└不知道該怎麼分類的綜合作品 (18)
文字創作 (1)
└草莓兵的國軍紀實 (14)
└我與らい的點點滴滴 (12)
└那些榮耀的時刻與心跳加速的瞬間 (60)
└有感而發的隨筆之作、無法分類的短文 (17)
語言學習 (1)
└日語:天気がいいから (5)
└粵語:唔好再淨係識講粗口喇 (6)
└英語:Hey, you! (1)
程式設計及電腦網路 (1)
└系列文:跟著豬腳 C 起來 (10)
└系列文:論壇網站運作原理 (3)
└Go(Golang) (11)
└Ruby / RGSS (7)
└Visual Basic (13)
└JavaScript (1)
└各種原理 (17)
思想:多思考一下,世界會更不一樣 (1)
└網路經驗、社會觀察 (23)
└檸檬庫 (21)
數學:我來拯救你的期中考了 (1)
└各類基礎觀念 (5)
└國中生也能懂的微積分 (9)
└微分方程 (0)
leon770530 給 巴友:
我的小屋首頁共有4篇健身相關證照心得文,對健身有興趣的朋友可以來看看喔!看更多我要大聲說昨天23:10