Why are you redefining the BGM and audiofile classes? If you're new to Ruby, it's also probably not the best idea to start with modules. I'm not really sure what you are trying to do here, honestly. bgm_play ( 'Town1' ] ) else end end I've formatted the code for you so it becomes more readable. bgm_pos end attr_accessor :pos end module Radio Radio_1 = :Shift end module CarRadio if Input. clone end end def replay play ( ) end def self. bgm_play ( 'Audio/BGM/' +, ,, pos ) = self. class RPG::AudioFile def initialize(name = '', volume = 100, pitch = 100) = name = volume = pitch end attr_accessor :name attr_accessor :volume attr_accessor :pitch end class RPG::BGM < RPG::AudioFile = RPG::BGM.new def play(pos = 0) if Audio.bgm_stop = RPG::BGM.new else Audio.bgm_play('Audio/BGM/' + pos) = self.clone end end def replay end def self.stop Audio.bgm_stop = RPG::BGM.new end def self.fade(time) Audio.bgm_fade(time) = RPG::BGM.new end def self.last = Audio.bgm_pos end attr_accessor :pos end module Radio Radio_1 = :Shift end module CarRadio if igger?(Radio::Radio_1) Audio.bgm_play('Town1']) else end end Thoughts?Ĭlass RPG :: AudioFile def initialize ( name = '', volume = 100, pitch = 100 ) = name = volume = pitch end attr_accessor :name attr_accessor :volume attr_accessor :pitch end class RPG :: BGM < RPG :: AudioFile = RPG :: BGM. I am able to run the game with the script except the BGM isn't playing after I press the button. I wanted to make a script were if a button was pressed a specific BGM would play. If I use the exact same Play command but the second time I set it to 50% volume, the only effect of the second Play command is to reduce the volume to 50%.So I'm trying to get started in Ruby scripting and I thought to start with something simple. I understand what you're trying to do, but I don't really understand why you think you need a specific command that only adjusts one parameter of the audio at a time, because the Play command effectively already works like that-you have to "set all the values at once," but if you only change one of the parameters since the last time the command was called, then only that parameter will change. When you say it doesn't work to use the Play command, what exactly does happen? For instance, when you do the example of two Play commands separated by a wait, the first Play command at 100 percent volume and the second at 50 percent, what happens? Have you looked for a plugin that does what you want to do? I'm fairly certain I've seen plugins devoted to "spatial" or "positional" audio that might save you a lot of trouble trying to build a system like this yourself with events or script calls.īeyond that, I'm baffled that the Play command isn't working for this. I know it works that way (at least for BGM) because I've used the same trick in my game to make BGM slightly quieter during dialogue. As long as you change only one of the parameters, as in this example, then you are effectively changing that parameter independently it should continue the same audio and simply adjust that one parameter. I'm not sure what you mean when you say the Play commands aren't enough because you want to change the values independently. So I would probably try it the event command way first I offered script calls only because you asked for them specifically. Note this script call is simply trying to achieve the same effect as the following ordinary event commands: The sound should play uninterrupted at full volume for 3 seconds and then drop to half volume. I'm pretty sure "Sound Object" is not actually part of the command but rather an example of the parameters the "ayBgs" function takes. I'm not 100% sure and I'm not at my machine to double check, but I believe the syntax on your script call is wrong.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |