Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

@wait.count = Song time?

Hi, I just want to ask if it's possible to make a wait count of a song's length? I mean to store it into a variable and calls it per @wait.count

Thanks.
 
I found this in the FFX2 Custom Menu System.

If my memory serves me right:

Code:
  def delay(seconds)
  for i in 0...(seconds * 1)
    sleep 0.01
    Graphics.update
  end
end

That's the method you would use in say Scene_Menu.

The in your updating method, or whatever method you want to put it in you would insert:

Code:
delay(0.1)

Now that's just a delaying method. I don't know where you want to delay the song though. Do you want to delay it in Scene_Map, Scene_Menu, Scene_Title, etc. Please specify.

~Constance
 
Well you would have to seemingly input the length of the song manually... I don't think it can be determined automatically, except possibly if there's a way to read the ID3 info of the MP3 file.
 
Well, this Delay is usable, too. Altough I want to use this thing on a map. You know this in BGII? If a battle starts, the music will change, but the one before will play trough. And if it's over, the other bg plays again. And make it sound good is hard. I will use this delay-thing. Thanks.
 
to handle a thing like this you would need to rewrite or add methods to the Audio class, which wouldn't be a simple task to achieve.

for me, the simpliest way to do this would be to create a variable :

@count = 0

and then increase it by one each frame :

Code:
def update
  @count += 1
  #rest of the update_method
end

and add an if statement to check if the number of seconds = what time you want

Code:
if @count / Graphics.frame_rate == 15 # 15 seconds
  # do something
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top