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.

Introductory Splash Screen

I forgot I wrote this... simply because I had it disabled  :tongue:

I wrote this a long time ago, when I couldn't find Dubealex's splash screen script (in his Crusaders1999 demo). My version is a little bit better though, because you can quickly skip through the splash by pressing C, and it runs smoother than DA's version

Everything important is commented in the script, please read the instructions. You will need to make 2 splashscreen images, perferably 640x480 in size, don't forget to name them appropriately in the script :wink:

Have fun with it and enjoy :thumb:

Code:
#=====================================#=========================================
# ~** Introductiory Splash Screen **~ #
#-------------------------------------#
#  Written by   : Kain Nobel
#  Version      : 4.6
#  Last Update  : 5/18/2008
#  Date Created : 2/19/2008
#===============================================================================
#  Special Thanks
#     Inspired by an old script by Dubealex.
#===============================================================================
SPLASH_DEBUG = true
#------------------------------------------
# true: script plays during editor playtest
# false: script only plays from Game.exe
#------------------------------------------
SPLASH_BGM = '060-Slow03'
SPLASH_BGS = '001-Wind01'
#----------------------------------------------------------
# nil     : Plays the Title Screen's BGM.
# ''      : Doesn't play any splash BGM.
# 'Song'  : Plays track, based on name, in your BGM folder.
#----------------------------------------------------------
SPLASH_SCREEN_01 = 'Splash01'
SPLASH_SCREEN_02 = 'Splash02'
#----------------------------------------------------------
# Must be named according to filename in the specified
# folder, 'Graphics/Titles'. The file extention should not
# matter unless you've got 2 images of the same name with
# different file extentions.
#----------------------------------------------------------
=begin
[INSTRUCTIONS]==================================================================
    For this script to work, you must go into 'main' and change this line...
    
    "$scene = Scene_Title.new"
    
    to
    
    "$scene = Scene_Splash.new"
    
    By default, this script will jump straight to Scene_Title during testplay
  through the editor, but you can view this script in action either through the
  Game.exe or setting 'SPLASH_DEBUG = true'.
[COMPATIBILITY]-----------------------------------------------------------------
    Should be compatible with anything and everything, including SDK (even
  though it doesn't have SDK openings and closings.) Just don't forget to change
  the info in 'main', or else the script won't do anything. (Don't forget to
  read the instructions in the section above this one, or else you might think
  this script doesn't do anything.)
===============================================================================
=end
class Scene_Splash
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  # * Main Method
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  def main
    #- - - - - - - - - - - - - -
    # * Public Variable Settings
    #- - - - - - - - - - - - - -
    @splash_bgm = SPLASH_BGM
    @splash_bgs = SPLASH_BGS
    @splash01 = SPLASH_SCREEN_01
    @splash02 = SPLASH_SCREEN_02
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Disables Splash Screens during Playtest (and battletest!)
    if $DEBUG == true && SPLASH_DEBUG == false
      @splash_bgm = ''
      $scene = Scene_Title.new
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Load the System database & create a new game
    $data_system = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Play Splash BGM
    if @splash_bgm == '' #<--Returns Title BGM
      $game_system.bgm_play($data_system.title_bgm)
    elsif @splash_bgm == nil #<--Returns No BGM
      $game_system.bgm_play(RPG::AudioFile.new(''))
    else #<--Returns User-Defined BGM
      $game_system.bgm_play(RPG::AudioFile.new(@splash_bgm))
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Play Splash BGS
    if @splash_bgs != '' or @splash_bgs != nil
      $game_system.bgs_play(RPG::AudioFile.new(@splash_bgs))
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Initilizes Splash Screen play information
    @show = true
    @transition = 0
    @splash_index = 2
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Defines Splash Screen 1 as its own 'sprite' object.
    @sprite1 = Sprite.new
    @sprite1.bitmap = RPG::Cache.title(@splash01)
    @sprite1.opacity = 0
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Defines Splash Screen 2 as its own 'sprite' object.
    @sprite2 = Sprite.new
    @sprite2.bitmap = RPG::Cache.title(@splash02)
    @sprite2.opacity = 0
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Graphics Transition
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      # Update Method
      update
      if $scene != self
        break
      end
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Dispose of Graphics after loop/update has finished.
    Graphics.freeze
    @sprite1.dispose
    @sprite2.dispose
  end
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  # Update the contents in this scene
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  def update
    # Changes Index if C button was pressed.
    if Input.trigger?(Input::C)
      case @splash_index
      #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      when 1 #Splash01
        if @transition > 0
          @show = false
          transition
        end
        #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      when 2 #Splash02
        if @transition > 0
          @show = false
          transition
        end
      end
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Change the opacity of the graphics
    transition
    # Update graphics
    @sprite1.update
    @sprite2.update
  end
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  # * Transition Method
  #- - - - - - - - - - -#
  #   This method cycles through the splash screen, changing
  # the opacity based on 'frames', determined by @transition
  # variable.
  #= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  def transition
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if @show == true
      @transition += 5
      if @transition > 750
        @show = false
        @transition = 255
      end
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # * Method for fading OUT the Splash Screen, cycle to next
    if @show == false
      @transition -= 10
      if @transition < 0
        @show = true
        @splash_index -= 1
        @transition = 0
      end
    end
    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # * Determines Next splash or go-to Scene_Title.
    case @splash_index
    when 0
      $scene = Scene_Title.new
    when 1
      @sprite2.opacity = @transition
    when 2
      @sprite1.opacity = @transition
    end
  end
end
 

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