Custom Title Screen Help

So, I've been trying to fix an issue with my game's title screen. Originally, it was all evented using images and script calls, but opening the Continue menu and exiting back out would cause the game to replay the splash screen I made using Himeworks' Splash Screen script. Eventually I decided to just bite the bullet and make a custom script for the title instead, and to my excitement, I've got it working! It's nearly exactly the same as my evented menu, without the annoying bug.

However, there's one aspect of the evented command that I'd like to replicate to give the title a bit more pizzazz, that I just can't seem to figure out. Originally, in my evented title screen, the game's title would start zoomed in way close to the player, zoom out to its normal size, shake a bit as if it were making contact with a wall, and be accompanied by a sound effect. In my current script, I'm able to replicate the zoom and the sound effect, but I have been chipping away, testing all sorts of possible solutions, and just cannot figure out how to replicate the shake.

My code currently:

Ruby:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_graphics
    create_shake
    #create_boom
    create_command_window
    play_title_music
  end
  #--------------------------------------------------------------------------
  # * Get Transition Speed
  #--------------------------------------------------------------------------
  def transition_speed
    return 1
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    SceneManager.snapshot_for_background
    dispose_background
    dispose_foreground
  end
  #--------------------------------------------------------------------------
  # * Create Graphics
  #--------------------------------------------------------------------------
  def create_graphics
    @logo = Sprite.new
    @logo.bitmap = Cache.picture("title_0")
    @logo.ox = @logo.width/2
    @logo.oy = @logo.height/2
    @logo.x = Graphics.width/2
    @logo.y = (Graphics.height/2)-32
    @logo.zoom_x = 5
    @logo.zoom_y = 5
    
    @foreground_sprite = Sprite.new
    @foreground_sprite.bitmap = Bitmap.new(Graphics.width,Graphics.height)
    @foreground_sprite.z = 100
    draw_game_title if $data_system.opt_draw_title
  end
  #--------------------------------------------------------------------------
  # * Draw Game Title
  #--------------------------------------------------------------------------
  def draw_game_title
    @foreground_sprite.bitmap.font.size = 48
    rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
    @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  end
  #--------------------------------------------------------------------------
  # * Boom Sound Effect
  #--------------------------------------------------------------------------
  def create_boom
      RPG::SE.new("Explosion1", 100, 100).play
  end
  #--------------------------------------------------------------------------
  # * Title Shake
  #--------------------------------------------------------------------------
  def create_shake
    @logo.x = (Graphics.width/2) + 4
    Graphics.wait(5)
    @logo.x = (Graphics.width/2) - 4
    Graphics.wait(5)
    @logo.x = Graphics.width/2
    create_boom
  end
  #--------------------------------------------------------------------------
  # * Update Graphics
  #--------------------------------------------------------------------------
  def update
    super
    if @logo.zoom_x != 1
      @logo.zoom_x -= 0.5
    end
    if @logo.zoom_y != 1
      @logo.zoom_y -= 0.5
    end
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @logo.bitmap.dispose
    @logo.dispose
  end
  #--------------------------------------------------------------------------
  # * Free Foreground
  #--------------------------------------------------------------------------
  def dispose_foreground
    @foreground_sprite.bitmap.dispose
    @foreground_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Move Sprite to Screen Center
  #--------------------------------------------------------------------------
  def center_sprite(sprite)
    sprite.ox = sprite.bitmap.width / 2
    sprite.oy = sprite.bitmap.height / 2
    sprite.x = Graphics.width / 2
    sprite.y = Graphics.height / 2
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_TitleCommand.new
    @command_window.set_handler(:new_game, method(:command_new_game))
    @command_window.set_handler(:continue, method(:command_continue))
    @command_window.set_handler(:credits, method(:command_credits))
    #@command_window.set_handler(:shutdown, method(:command_shutdown))
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  def close_command_window
    @command_window.close
    update until @command_window.close?
  end
  #--------------------------------------------------------------------------
  # * [New Game] Command
  #--------------------------------------------------------------------------
  def command_new_game
    DataManager.setup_new_game
    close_command_window
    fadeout_all
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
  end
  #--------------------------------------------------------------------------
  # * [Continue] Command
  #--------------------------------------------------------------------------
  def command_continue
    close_command_window
    SceneManager.call(Scene_Load)
  end
  #--------------------------------------------------------------------------
  # * [Credits] Command
  #--------------------------------------------------------------------------
  def command_credits
    close_command_window
    fadeout_all
    $game_map.setup(4)
    SceneManager.goto(Scene_Map)
  end
=begin
  #--------------------------------------------------------------------------
  # * [Shut Down] Command
  #--------------------------------------------------------------------------
  def command_shutdown
    close_command_window
    fadeout_all
    SceneManager.exit
  end
=end
  #--------------------------------------------------------------------------
  # * Play Title Screen Music
  #--------------------------------------------------------------------------
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end
end

I have been scouring all over for tutorials and documentation and looking in other scripts to see if I can pick up any possible script calls that I might not know about and I have come up empty-handed. Any help would be greatly appreciated!
Your shake effect simply lasts for less than a second. That's why you can't truly notice any real shaking on screen.
Yeah, it's not meant to last for very long. In the evented title screen I made, the amount of frames each position was held was 1 frame, but it was set to 'Wait for completion', and one frame was long enough to see movement. I've also tried writing my shake effect as:

Ruby:
#--------------------------------------------------------------------------
  # * Title Shake
  #--------------------------------------------------------------------------
  def create_shake
    if @logo.x != (Graphics.width/2) + 4
      @logo.x += 4
    end
    Graphics.wait(5)
    if @logo.x != (Graphics.width/2) - 4
      @logo.x -= 4
    end
    Graphics.wait(5)
    if @logo.x != (Graphics.width/2)
      @logo.x += 4
    end
    create_boom

Similarly to how I used 'if' statements for the zoom, but there's still no movement. If I had to guess, it's because the zoom uses 'def update', but when I tried including the shake and boom effects in the update, it lagged the game and caused it to crash. I'm guessing that using 'update' calls the code once every frame, and so if I used it for the shake, it would just cause it to shake and play the boom effect repeatedly. I'm also unsure of how I would call it during the 'start' processing. Is it possible to have a 'def' inside of another 'def'?
It's possible to include a def there but it's moronic to say the least. A terrible practice indeed.
No need to be condescending.

@kyonides Let's not be insulting by calling something 'moronic'.

People post to get help because they don't know how to do something, there's no reason to post to say something is a terrible practice and then not explain why it's not a good idea or suggest an alternative.
You can complain as much as you want here, but I am telling the truth. The OP wants to use a very, extremely obscure "feature" (logical error) that makes Ruby behave in some inadequate manner. I strongly have to warn people against ever considering that possibility at all. You simply don't do it. Like never. It's a terrible design pattern.

This is not my first time reading how someone wants to do that. The reply has always been the same. You simply never do that! There is another terrible idea regarding an non recommendable way to include of modules in classes or modules that I discussed on another board months ago. The thing is that Ruby core developers left some parsing / interpreting issues behind like the one presented here a couple of posts above. The best practice is to strongly discourage the use of such "non-features" from the very beginning.

Actually, there's a third issue that I can think off on top of my head. It has a lot to do with what you do right after a Ruby block ends under a certain circumstance. It's not as dark as the other 2, but it's a bad idea as well.

@hiddenone you naturally expect people to help, but the OP isn't ready to get a deep explanation on core Ruby features and hidden issues and undesirable side effects, that some people might wanna call logical errors or bugs depending on their stance on certain programming logic topics. And yes, the use of all those "bugs" is moronic, is going down the rabbit hole because one wants to suffer on purpose. I NEVER said the OP was such a thing for proposing them. Relying on such "bugs" goes beyond what's normally called terrible.

It's like a teacher that tells his wannabe programmers that if they do a certain thing, a cat will die. It's just a way to tell them that they should never do that as if that ridiculous statement about cats were about to happen at that moment they break the rules.
Dude. Chill.

I'm looking for help and you aren't being helpful at all. You're just being a snarky, know-it-all brat. I don't know Ruby. Even among the basics of the language, I am a beginner at best. I'm not claiming to be some master of the language, nor do I ever expect to be. If I was, I wouldn't be here asking for help.

Meanwhile, you're being overtly antagonistic towards me for literally no reason, and haven't offered any sort of solutions at all. Pretty sad, considering your 'About Me' is just the scripting languages you're supposedly so good at.

Get down from your high horse before you hurt yourself.

EDIT: Lol, reacting to me calling you on your crap with the 'Angry' emote. Did I touch a nerve?
I'm doing you a favor by telling you what NOT to do. Just accept that piece of advice for your own good. That's all I'm asking you. Do you wanna get a slight idea of what you'd be doing there if you implement that idea? Fine. You'd be breaking encapsulation and it's really terrible. Does that help you even a bit?

I'll give you another example of things that break code like lighting bolt.

Never divide any number by zero. You simply don't do it. And nope, you never go after all mathematicians that warn you against doing that. That's the kind of thing I'm explaining here, except that the other concept is worse than that because the language doesn't stop you from doing it... but it should. Sadly, it doesn't. (Anybody could file a bug report on Ruby's bug list site and... get ignored.)
Nope. No idea what any of that means. I'm guessing it means I'd be breaking how code is separated amongst itself, but again, complete beginner at best.

And still no solutions from you.
I’ll just make a gentle call to bring everything back to a zen place.
Let’s reset.
OK, so Luca shouldn’t do the thing. What should Luca do instead?

Nice but optional detail: beginner-friendly explanation of “breaking encapsulation” for our newbie Ruby and why that is bad news bears.
How about
Ruby:
  #--------------------------------------------------------------------------
  # * Title Shake
  #--------------------------------------------------------------------------
  def create_shake
    10.times do
      if @logo.x != (Graphics.width/2) + 4
        @logo.x += 4
      end
      Graphics.wait(5)
      if @logo.x != (Graphics.width/2) - 4
        @logo.x -= 4
      end
      Graphics.wait(5)
      if @logo.x != (Graphics.width/2)
        @logo.x += 4
      end
    end
  end
Thank you @Ms Littlefish and @Roninator2

In regards to the new code there, at first nothing really changed, then I added the 'create_boom' back in under the first 'end', and it just kind of played the boom a bunch and then did the zoom with no change to the title graphic's x position. I think the problem(s) is that the create_shake portion of the 'start' method is being called on or before the first frame of the zoom, and also that the actual shaking isn't being run under any sort of update method that would be reflected graphically.

For posterity's sake, I also tried changing my zoom code to:

Ruby:
  #--------------------------------------------------------------------------
  # * Update Graphics
  #--------------------------------------------------------------------------
  def create_zoom
    10.times do
      if @logo.zoom_x != 1
        @logo.zoom_x -= 0.5
      end
      if @logo.zoom_y != 1
        @logo.zoom_y -= 0.5
      end
    end
  end

And adding the 'create_zoom' to the start method above 'create_shake', but now it just plays the boom a bunch in quick succession, and the title just pops into place as opposed to zooming.
And adding the 'create_zoom' to the start method above 'create_shake', but now it just plays the boom a bunch in quick succession, and the title just pops into place as opposed to zooming.
Because your boom should be in the start not in the create_shake.
The zoom doesn't need a 10.times.
just put update at the bottom of create_shake

But I have no idea what you are doing because you are changing code around faster than I can test.
Sorry, I'll take a bit more time. Just figured I'd give you all the information I've got.

Where at the bottom of create_shake should update go? Because I've tried putting it after each 'end' and I either get an error on launch, or the shake still doesn't occur, and if I open a menu like the continue screen and then back out, I get a 'disposed window' error.
I get a 'disposed window' error.
OK, how close is this to what you want?
Spoiler: custom shake title
Ruby:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    $start_title ||= false
    SceneManager.clear
    create_background
    create_foreground
    if $start_title == false
      Graphics.transition(5)
      zoom_out
      create_fuse
      create_shake
      create_boom
    else
      Graphics.transition(5)
      zoom_out
      create_shake
    end
    create_command_window
    play_title_music
    $start_title = true
  end
  #--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  def create_background
    @logo = Sprite.new
    @logo.bitmap = Cache.picture("circle")
    @logo.ox = @logo.width/2
    @logo.oy = @logo.height/2
    @logo.x = Graphics.width/2
    @logo.y = (Graphics.height/2)-32
    @logo.zoom_x = 5
    @logo.zoom_y = 5
  end
  #--------------------------------------------------------------------------
  # * Create Foreground
  #--------------------------------------------------------------------------
  def create_foreground
    @foreground_sprite = Sprite.new
    @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    @foreground_sprite.z = 100
    draw_game_title if $data_system.opt_draw_title
  end
  #--------------------------------------------------------------------------
  # * Draw Game Title
  #--------------------------------------------------------------------------
  def draw_game_title
    @foreground_sprite.bitmap.font.size = 48
    rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
    @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  end
  #--------------------------------------------------------------------------
  # * Boom Sound Effect
  #--------------------------------------------------------------------------
  def create_fuse
    RPG::BGS.new("Fire", 100, 100).play
  end
  #--------------------------------------------------------------------------
  # * Boom Sound Effect
  #--------------------------------------------------------------------------
  def create_boom
    RPG::BGS.stop
    RPG::SE.new("Explosion1", 100, 100).play
  end
  #--------------------------------------------------------------------------
  # * Title Shake
  #--------------------------------------------------------------------------
  def create_shake
    10.times do
      if @logo.x != (Graphics.width/2) + 4
        @logo.x += 4
      end
      Graphics.wait(5)
      if @logo.x != (Graphics.width/2) - 4
        @logo.x -= 4
      end
      Graphics.wait(5)
      if @logo.x != (Graphics.width/2)
        @logo.x += 4
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Zoom
  #--------------------------------------------------------------------------
  def zoom_out
    40.times do
      if @logo.zoom_x != 1
        @logo.zoom_x -= 0.1
      end
      if @logo.zoom_y != 1
        @logo.zoom_y -= 0.1
      end
      Graphics.update
    end
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @logo.bitmap.dispose
    @logo.dispose
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_TitleCommand.new
    @command_window.set_handler(:new_game, method(:command_new_game))
    @command_window.set_handler(:continue, method(:command_continue))
    @command_window.set_handler(:credits, method(:command_credits))
  end
  #--------------------------------------------------------------------------
  # * [New Game] Command
  #--------------------------------------------------------------------------
  alias r2_new_game_clear_global_variable  command_new_game
  def command_new_game
    r2_new_game_clear_global_variable
    $start_title = nil
  end
  #--------------------------------------------------------------------------
  # * [Credits] Command
  #--------------------------------------------------------------------------
  def command_credits
    close_command_window
    fadeout_all
    $game_map.setup(4)
    SceneManager.goto(Scene_Map)
  end
end

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Processing When Load Is Successful
  #--------------------------------------------------------------------------
  alias r2_load_success_global_variable_clear on_load_success
  def on_load_success
    r2_load_success_global_variable_clear
    $start_title = nil
  end
end
Sorry, it just crashes on launch. I also tried loading it into two other projects, one I use for general testing and one completely fresh project, and got the same error.
The original Scene_Title that is part of your Scripts Library contains a command_new_game method. That being this snippet:

* From the original code you presented Tuesday
#-------------------------------------------------------------------------- # * [New Game] Command #-------------------------------------------------------------------------- def command_new_game DataManager.setup_new_game close_command_window fadeout_all $game_map.autoplay SceneManager.goto(Scene_Map) end

But the code in which Roninator posted uses the 'alias' command to merely attach his extra code into the command_new_game... not to replace it.

* From Roninator's code
#-------------------------------------------------------------------------- # * [New Game] Command #-------------------------------------------------------------------------- alias r2_new_game_clear_global_variabble command_new_game def command_new_game r2_new_game_clear_global_variabble $start_title = nil end

If you are receiving that pop-up error notice, it is claiming the command_new_game method doesn't exist... and is forcing this query from me.

Did you paste Roninator's code atop and replace Scene_Title? For his script assumes the original and the 'command_new_game' method still exists.

NOTE: It is considered to be unadvised to actually change/edit the default scripts themselves. Instead, one should make replacement scripts that appear in an area which (for VXAce users) is between Scene_Gameover and above Main... labeled Materials. That way, the original scripts are untouched and can be referred to, or have code attached without causing harm.

I may not have VXAce, but the basics of Ruby are prevalent nonetheless.
one completely fresh project, and got the same error.
I don't know what your doing then. Must be something really wrong.
Just as DerVVolfman said where are you putting this script?
Ah, that's the problem then, I kept the original Scene_Title in each project I loaded Roninator's into, but commented it out. It still exists, just, it isn't being run.

Having uncommented the original, the script does work now, but it's not quite what I'm aiming for. The way it is now it just kind of shakes while slowly zooming out. What I'm hoping to make it do is zoom out, then when it stops zooming that's when it shakes and causes the boom sound. Think like, it's moving quickly away from the player, and shaking once it hits a wall.

EDIT: I've got the script at the very bottom of the base engine 'Scene_' scripts.

Original thread: https://forums.rpgmakerweb.com/threads/custom-title-screen-help.159202/