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:
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!
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!