Project1
标题:
问下动画播放的问题
[打印本页]
作者:
Wind2010
时间:
2011-2-14 12:06
标题:
问下动画播放的问题
class Game_System
attr_accessor :music_num
attr_accessor :sound_num
attr_accessor :auto_save
alias shizi_initialize initialize
def initialize
shizi_initialize
@music_num = 100
@sound_num = 100
@auto_save = false
end
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume * @music_num / 100, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * @music_num / 100, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume * @sound_num / 100, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume * @sound_num / 100, se.pitch)
end
end
end
class Scene_Select
def main
@screen = Spriteset_Map.new
s1 = " 音乐 "
s2 = " 音效 "
s3 = "自动存档"
@wd1 = Window_Command.new(128,[s1,s2,s3])
@wd1.x = 158
@wd1.y = 176
@wd2 = Window_Base.new(0,0,324,128)
@wd2.contents = Bitmap.new(292,96)
@wd2.x = 158
@wd2.y = 176
@wd2.active = false
wd2_refresh
@wd3 = Window_Base.new(0,0,324,128)
@wd3.contents = Bitmap.new(292,96)
@wd3.x = 158
@wd3.y = 176
wd3_refresh
@wd4 = Window_Base.new(0,0,324,128)
@wd4.contents = Bitmap.new(292,96)
@wd4.x = 158
@wd4.y = 176
@wd4.active = false
wd4_refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@screen.dispose
@wd1.dispose
@wd2.dispose
@wd3.dispose
@wd4.dispose
end
def update
$windspeed.update
if @wd2.active
return music_update
end
if @wd4.active
return sound_update
end
@wd1.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @wd1.index
when 0
@wd2.active = true
@wd1.active = false
when 1
@wd4.active = true
@wd1.active = false
when 2
$game_system.auto_save ? $game_system.auto_save = false : $game_system.auto_save = true
wd3_refresh
end
end
end
def wd2_refresh
@wd2.contents.clear
@wd2.contents.fill_rect(128,14,102,4,Color.new(255,255,255,255))
@wd2.contents.fill_rect(129,15,100,2,Color.new(25,25,255,255))
@wd2.contents.fill_rect(126+$game_system.music_num,11,4,10,Color.new(255,255,255,255))
@wd2.contents.draw_text(235,0,100,32,$game_system.music_num.to_s)
end
def wd4_refresh
@wd4.contents.clear
@wd4.contents.fill_rect(128,46,102,4,Color.new(255,255,255,255))
@wd4.contents.fill_rect(129,47,100,2,Color.new(25,25,255,255))
@wd4.contents.fill_rect(126+$game_system.sound_num,43,4,10,Color.new(255,255,255,255))
@wd4.contents.draw_text(235,32,100,32,$game_system.sound_num.to_s)
end
def wd3_refresh
@wd3.contents.clear
$game_system.auto_save ? @wd3.contents.draw_text(128,64,164,32,"开",1) : @wd3.contents.draw_text(128,64,164,32,"关",1)
end
def music_update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@wd2.active = false
@wd1.active = true
end
if Mouse.press?(Mouse::LEFT)
mouse_x, mouse_y = Mouse.get_mouse_pos
if mouse_x >= 302 and mouse_x <= 402 and mouse_y >= 203 and mouse_y <= 213
@music = mouse_x - 302
if @music != $game_system.music_num
$game_system.music_num = @music
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
wd2_refresh
end
end
end
if Input.repeat?(Input::LEFT) and $game_system.music_num > 0
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
$game_system.music_num -= 1
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
wd2_refresh
end
if Input.repeat?(Input::RIGHT) and $game_system.music_num < 100
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
$game_system.music_num += 1
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
wd2_refresh
end
end
def sound_update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@wd4.active = false
@wd1.active = true
end
if Mouse.press?(Mouse::LEFT)
mouse_x, mouse_y = Mouse.get_mouse_pos
if mouse_x >= 302 and mouse_x <= 402 and mouse_y >= 235 and mouse_y <= 245
@sound = mouse_x - 302
if @sound != $game_system.sound_num
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
$game_system.sound_num = @sound
wd4_refresh
end
end
end
if Input.repeat?(Input::LEFT) and $game_system.sound_num > 0
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
$game_system.sound_num -= 1
wd4_refresh
end
if Input.repeat?(Input::RIGHT) and $game_system.sound_num < 100
Audio.se_play("Audio/SE/032-Switch01",100 * $game_system.sound_num / 100)
$game_system.sound_num += 1
wd4_refresh
end
end
end
class Scene_Map
alias shizixd update
def update
auto_save if $game_system.auto_save
shizixd
end
def auto_save
cundang if $game_variables[1] == 0
if $game_variables[1] != 0
filename = "Save#{$game_variables[1]}.rxdata"
file = File.open(filename, "wb")
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
$game_system.magic_number = $data_system.magic_number
Marshal.dump(Graphics.frame_count, file)
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
file.close
end
end
end
复制代码
自己写了一个改变音量的脚本,一般的声音都可以改变音量,但是在播放动画时,动画的SE音量大小不能控制。怎样才可以把动画的SE音量也改变? dsu_plus_rewardpost_czw
作者:
Wind2010
时间:
2011-2-15 12:14
本帖最后由 Wind2010 于 2011-2-15 12:14 编辑
1天自顶...
作者:
tamashii
时间:
2011-2-15 13:12
动画中的se是在数据库中存储的吧
不行的话重写Audio模型
module Audio
alias bgm_play old_bgm
def self.bgm_play(filename, volume = 100, pitch = 100)
old_bgm(filename, 音量, pitch)
end
end
复制代码
作者:
Wind2010
时间:
2011-2-15 13:15
回复
tamashii
的帖子
BGS、ME、SE都可以这样子吗?
作者:
tamashii
时间:
2011-2-15 13:23
本帖最后由 tamashii 于 2011-2-15 13:33 编辑
那看来是我的代码错了
module Audio
alias old_bgm bgm_play
def self.bgm_play(filename, volume=100, pitch=100)
old_bgm(filename, 100, pitch)
end
end
复制代码
这回再试试
作者:
Wind2010
时间:
2011-2-16 20:58
自顶....
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1