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.

Timing in scripts

I need help with the last element in one of my scripts. I need to know how to make a timer in a script that, when the timer is up, disposes a window. I'm making a window that shows the name of the map as defined by a global variable that changes from map to map. Can anyone help on the timing issue?
 
you can do something like this:
Code:
class Scene_Menu

  def main
    @window = Window_something.new
    @wait = 0
    @totalwait = 100
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @window.dispose
  end

  def update
    @window.update
    if @wait != @totalwait
      @wait += 1
    else
      @window.visible = false
    end
  end
end
Just wrote it so not sure if it'll actually work but i think thats how it is =P
 
no problem and i think for the total time wait is like 4 for a sec, so if you want it to show for like 10 secs you put it to 40, i think not sure but i do know that more then 1 frame = a sec, not sure how many though =P
 

khmp

Sponsor

Its around 40~ frames a second. Unless you made a change to Graphics.frame_rate. So a 10 second wait would be 400. In VX its been adjusted to 60. Just a little "for your information" Midnight.
 

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