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.

Moving windows off screen before a $scene change

Welp, now that my moving windows script works all lovely like, I would like to know how to stall the whole Graphics.transition, loop do, scene break, go to scene new stuff in the 'main' method of a scene.

Basically, all I need is for that process (where the scene changes to the next scene) to stall long enough to let all of my Windows to move off the screen. Can somebody help me, I haven't figured out how to do it on my own yet.
 

khmp

Sponsor

You mean the Graphics.freeze though right? After the do loop inside main you could have something like:
Code:
while @window_suchandsuch.is_moving?
  # update windows
  Graphics.update
end

Or you could incorporate some kind of check into update that disallows the scene from changing until the windows have stopped moving. In any case I think you'll need some kind of boolean built into your window that is able to tell whether or not a window has stopped moving or is currently moving.
Code:
def update
  while @window_suchandsuch.is_moving?
    # update windows
    Graphics.update
  end
  ... other update code
end
 
If I understand your question right, you need to mod the break case in the main loop. Basically:
Code:
while $scene != self
  break
end

Add another condition to the $scene != self, the condition being that the x or y coordinate of one of the exitting windows when they are all out of the screen. Something like:
Code:
while $scene != self && @window.x >= 640

Hope that helps :)
 

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