Jump to content
Vincent

Press Start script

Recommended Posts

This script is extremely basic, but since I could not find anything similar on this forum I decided to go ahead and post it here. It's pretty much what it sounds like, a "Press Start" message on the title screen. The message can either be plain text or a custom image, as seen below.

 

Script

 

 

#==============================================================================
# ** Press Start
# By Vincent, but you don't have to credit me. I made the first version of this
# script in like five minutes.
#------------------------------------------------------------------------------
# Adds a "Press Start" function before the title screen.
#
# This script MUST go below Scene_Title and any custom scripts that make
# changes to Scene_Title! Though I cannot guarantee compatibilty with such
# scripts.
#
# Versions:
#
# *November 5, 2014  - Fourth release.
# October 19, 2014  - Converted constants to module stuff.
# October 15, 2014  - Removed spacing since the width adjustment makes it
#                     redundant.
# *October 14, 2014 - Third release. Unaliased the redundant things because I
#                     am such an amateur. Added picture option as per
#                     melmarvin's suggestion.
# *October 13, 2014 - Second release, added melmarvin's suggestion to make the
#                     Press Start window transparent.
# October 11, 2014  - Aliased everything because I should probably do that.
# *October 10, 2014 - First release
#==============================================================================

module PressStart
#**PUT YOUR CUSTOM PRESS START MESSAGE HERE! Be creative!**

  PressStartMSG = "Press Start"
  
# If using a pic, specify the filename and desired dimensions here. If not,
# please leave this alone.

  UsePSImage   = false            #Default: false
  PSPic        = nil              #Default: nil
  PSWidth      = 160              #Default: 160
  PicHeight    = 24               #Default: 24
end

#==============================================================================
#Editing from this point onward is not recommended. But I can't stop you. I'm
#not your real dad.
#==============================================================================
module SceneManager
  class << self
    def first_scene_class
      $BTEST ? Scene_Battle : Scene_PressStart
    end
  end
end

class Game_Interpreter
  def command_354
    SceneManager.goto(Scene_PressStart)
    Fiber.yield
  end
end

class Scene_Map < Scene_Base
  def pre_terminate
    super
    pre_battle_scene if SceneManager.scene_is?(Scene_Battle)
    pre_title_scene  if SceneManager.scene_is?(Scene_PressStart)
  end
end

class Scene_Battle < Scene_Base
  alias pause_preterminate pre_terminate
  def pre_terminate
    pause_preterminate
    super
    Graphics.fadeout(60) if SceneManager.scene_is?(Scene_PressStart)
  end
end

class Scene_Gameover < Scene_Base
  def goto_title
    fadeout_all
    SceneManager.goto(Scene_PressStart)
  end
end

class Scene_Title < Scene_Base
  def start
    super
    create_background
    create_foreground
    create_command_window
  end
  def transition_speed
    return 0
  end
end

#==============================================================================
# This totally was not pasted from Scene_Title or anything.
#==============================================================================

class Scene_PressStart < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    SceneManager.clear
    Graphics.freeze
    create_background
    create_foreground
    create_command_window
    play_title_music
  end
  #--------------------------------------------------------------------------
  # * Get Transition Speed
  #--------------------------------------------------------------------------
  def transition_speed
    return 20
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    SceneManager.snapshot_for_background
    dispose_background
    dispose_foreground
  end
  #--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  def create_background
    @sprite1 = Sprite.new
    @sprite1.bitmap = Cache.title1($data_system.title1_name)
    @sprite2 = Sprite.new
    @sprite2.bitmap = Cache.title2($data_system.title2_name)
    center_sprite(@sprite1)
    center_sprite(@sprite2)
  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
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  def dispose_background
    @sprite1.bitmap.dispose
    @sprite1.dispose
    @sprite2.bitmap.dispose
    @sprite2.dispose
  end
  #--------------------------------------------------------------------------
  # * Free Foreground
  #--------------------------------------------------------------------------
  def dispose_foreground
    @foreground_sprite.bitmap.dispose
    @foreground_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Move Sprite to Screen Center adachi is the killer
  #--------------------------------------------------------------------------
  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_PressStart.new
    @command_window.set_handler(:press_start, method(:command_press_start))
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  def close_command_window
    @command_window.close
    update until @command_window.close?
  end
  #--------------------------------------------------------------------------
  # * [Press_Start] Command
  #--------------------------------------------------------------------------
  def command_press_start
    SceneManager.goto(Scene_Title)
  end
  #--------------------------------------------------------------------------
  # * [Continue] Command
  #--------------------------------------------------------------------------
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end
end

#==============================================================================
# This looks like Window_Title? You're crazy!
#==============================================================================

class Window_PressStart < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    self.openness = 0
    self.opacity = 0
    open
  end
  
  if PressStart::UsePSImage
    alias pspic_update update
    def update
      pspic_update
      self.contents = Cache.picture(PressStart::PSPic)
    end
  end
  #--------------------------------------------------------------------------
  # * Get Line Height
  #--------------------------------------------------------------------------
  if PressStart::UsePSImage
    alias ps_height line_height
    def line_height
      ps_height
      return PressStart::PicHeight
    end
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  if PressStart::UsePSImage
    def window_width
      return PressStart::PSWidth
    end
  end
  #--------------------------------------------------------------------------
  # * Update Window Position
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height * 1.6 - height) / 2
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(PressStart::PressStartMSG, :press_start)
  end
end

 

 

 

Screenshots

Screenshot2014-10-13115140.png

 

Screenshot2014-10-14184626.png

 

Screenshot2014-10-10134832.png

 

Instructions

Just paste it into the materials section. Make sure it's below any script that alters Scene_Title. If a custom image is used, you will need to place the images in Graphics/Pictures and  customize the appopriate settings in the script.

 

Known issues

I cannot guarantee compatibility with custom scripts that alter the title screen. This Press Start script could not work with a certain script that used a map as the title, for instance.

 

Credits

Me, but you don't need to credit me or anything

Edited by Vincent

Share this post


Link to post
Share on other sites

*Suggestion:
Replace Lines 186-198 with:

class Window_PressStart < Window_Command
  
  MYSTRING = " " << PRESS_START_MSG
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    self.openness = 0
    self.opacity = 0
    open
  end

and line 216:

    add_command(MYSTRING, :press_start)

It's only personal preference though.

 

EDIT: Nice script :D

Edited by melmarvin

Share this post


Link to post
Share on other sites

Hey, thanks for the feedback! I was actually planning on making it transparent so that it would look better, but I am just now getting to really learn RGSS3 so I didn't fully understand the super keyword until yesterday. The original post has been updated to reflect your addition. Thanks again!

Share this post


Link to post
Share on other sites

I don't completely understand 'super' too.
So i just set my mindset that it makes sure that it "copy pastes" the code from the appended class's stuff.
Ahaha i can't explain.

It'd be neat if we could add an image instead of text.

or maybe have an option to do so

#MoreSuggestionsLol

Share this post


Link to post
Share on other sites

I don't completely understand 'super' too.

So i just set my mindset that it makes sure that it "copy pastes" the code from the appended class's stuff.

Ahaha i can't explain.

 

It'd be neat if we could add an image instead of text.

or maybe have an option to do so

#MoreSuggestionsLol

 

super is used for inheritance (such as inherited classes).  When used in RGSS3 (with no arguments), super sends a message to the parent of the current object, asking it to invoke a method of the same name as the method invoking super. It automatically forwards the arguments that were passed to the method from which it's called. When called with an empty argument list - super()-it sends no arguments to the higher-up method, even if arguments were passed to the current method. When called with specific arguments - super(a, b, c) - it sends exactly those arguments.

 

For example:

class Parent
   def circular_bezier
     puts "Bezier"
   end
end

class Child < Parent
   def circular_bezier
     super
   end
end

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×