Splash Script
#15
hey, made it doesnt need the SDK anymore ;o
Code:
#==============================================================================
# ** Splash Script
#------------------------------------------------------------------------------
# - Coded by :shadowseer
# - Original by :Lambchops
# - Version :1.0
# - 24/02/2010
#------------------------------------------------------------------------------
# * How to Use:
# - Just add more filenames to SplashFiles = ['filename', ..., ...]
# - and configure the speed of loading each images.
# - That's it ;o
#==============================================================================

module SSConfig
  #----------------------------------------------------------------------------
  # * Splash Files
  #     :folder- :Graphics/Picture
  #     :config- :['filename', 'filename', ..., ...]
  #----------------------------------------------------------------------------
  SplashFiles = ['splash_sample01', 'splash_sample02', 'splash_sample03']
  #----------------------------------------------------------------------------
  # * Splash Speed
  #     :the speed of transition, 2-4 is ideal
  #----------------------------------------------------------------------------
  SplashSpeed = 3
  #----------------------------------------------------------------------------
  # * Play Music During Splash?
  #     :config- :true / false
  #     :do you want to play music during the splash?
  #----------------------------------------------------------------------------
  PlayMusic = true
  #----------------------------------------------------------------------------
  # * Music File
  #     :folder- :Audio/BGM
  #     :use the filename for the audio. (dont need the extention i suppose)
  #----------------------------------------------------------------------------
  MusicFile = '015-Theme04'
end

class Scene_Splash
  #----------------------------------------------------------------------------
  # * Main
  #----------------------------------------------------------------------------
  def main
    # Setup Variables
    main_variable
    # Setup Sprites
    main_sprite
    # Setup Audio
    main_audio
    # Execute transition
    Graphics.transition
    # Run main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      break if $scene != self
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose sprites
    @sprites.each {|i| i.dispose}
  end  
  #----------------------------------------------------------------------------
  # * Main: Variable
  #----------------------------------------------------------------------------
  def main_variable
    # Setup important variables
    @index = 0
    @hide = false
    @show = true
    @opacity = 0
  end
  #----------------------------------------------------------------------------
  # * Main: Sprite
  #----------------------------------------------------------------------------
  def main_sprite
    # Setup array
    @sprites = []
    # Make sprites
    SSConfig::SplashFiles.each_with_index do |filename, i|
      @sprites[i] = Sprite.new
      @sprites[i].bitmap = RPG::Cache.picture(filename)
      @sprites[i].opacity = 0
    end
  end
  #----------------------------------------------------------------------------
  # * Main: Audio
  #----------------------------------------------------------------------------
  def main_audio
    # Play BGM
    Audio.bgm_play('/Audio/BGM/' + SSConfig::MusicFile) if SSConfig::PlayMusic
  end
  #----------------------------------------------------------------------------
  # * Frame Update
  #----------------------------------------------------------------------------
  def update
    # If input triggered
    if Input.trigger?(Input::C) || Input.trigger?(Input::B)
      # Switch to Title
      Audio.bgm_fade(1000) if SSConfig::PlayMusic
      $scene = Scene_Title.new
    end
    # Do Hide/Show images
    process_transition
  end
  #----------------------------------------------------------------------------
  # * Process Transition
  #----------------------------------------------------------------------------
  def process_transition
    # Fade In
    if @show
      # Increase Opacity
      @opacity += SSConfig::SplashSpeed
      # If Opacity's at maximum
      if @opacity > 255
        # Hide images
        @hide = true
        @show = false
        @opacity = 255
      end
    end
    # Fade Out
    if @hide
      # Decrease Opacity
      @opacity -= SSConfig::SplashSpeed
      # If Opacity's at minimum
      if @opacity < 0
        # Show images
        @hide = false
        @show = true
        @opacity = 0
        # Change Index
        @index += 1
      end
    end
    # Branch by index
    case @index
    when 0...SSConfig::SplashFiles.size
      # Set Opacity
      @sprites[@index].opacity = @opacity
    when (SSConfig::SplashFiles.size)
      # Switch to Title
      Audio.bgm_fade(1000) if SSConfig::PlayMusic
      $scene = Scene_Title.new
    end
  end
end
Reply }


Messages In This Thread
Splash Script - by rm-rf - 02-24-2010, 06:36 PM
Splash Script - by deValdr - 02-24-2010, 06:39 PM
Splash Script - by rm-rf - 02-24-2010, 06:44 PM
Splash Script - by deValdr - 02-24-2010, 06:56 PM
Splash Script - by Villain - 02-25-2010, 01:31 PM
Splash Script - by rm-rf - 02-25-2010, 02:30 PM
Splash Script - by Villain - 02-25-2010, 09:49 PM
Splash Script - by rm-rf - 02-26-2010, 01:58 AM
Splash Script - by deValdr - 02-26-2010, 04:03 PM
Splash Script - by Ace - 02-26-2010, 05:41 PM
Splash Script - by deValdr - 02-26-2010, 05:53 PM
Splash Script - by Ace - 02-26-2010, 06:04 PM
Splash Script - by rm-rf - 02-26-2010, 08:48 PM
Splash Script - by deValdr - 02-26-2010, 09:04 PM
Splash Script - by rm-rf - 02-26-2010, 09:22 PM
Splash Script - by Ryu-ka - 03-18-2010, 04:35 AM
Splash Script - by rm-rf - 03-18-2010, 04:41 AM
Splash Script - by Villain - 03-18-2010, 11:13 AM
Splash Script - by rm-rf - 03-18-2010, 11:38 AM
Splash Script - by Ryu-ka - 03-18-2010, 03:17 PM
Splash Script - by Villain - 03-18-2010, 06:15 PM
Splash Script - by yamina-chan - 03-18-2010, 06:21 PM
Splash Script - by rm-rf - 03-19-2010, 12:57 AM
Splash Script - by Ryu-ka - 03-20-2010, 06:03 AM
Splash Script - by rm-rf - 03-20-2010, 08:15 AM
Splash Script - by Ryu-ka - 03-20-2010, 05:48 PM
Splash Script - by rm-rf - 03-20-2010, 08:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Text Scroll Script - Enhanced DerVVulfman 23 34,331 02-18-2021, 04:16 AM
Last Post: DerVVulfman
   Cursor Script Selwyn 7 15,366 09-28-2019, 02:13 PM
Last Post: DerVVulfman
   ACBS FIX SCRIPT #2: Advanced Cry Correction DerVVulfman 1 4,777 08-09-2019, 03:42 PM
Last Post: aeliath
   ACBS FIX SCRIPT #1: Victory Cries Patch DerVVulfman 1 4,711 08-08-2019, 02:53 PM
Last Post: aeliath
   Spritesheet Generator Conversion Script DerVVulfman 0 4,254 11-21-2018, 04:48 AM
Last Post: DerVVulfman
   Neo Mode 7 Script by MGCaladtogel MGC 59 125,489 09-29-2017, 03:48 AM
Last Post: DerVVulfman
   Longer Script Calls LiTTleDRAgo 0 4,966 05-17-2017, 12:36 AM
Last Post: LiTTleDRAgo
   SLOLS: Snake Look-alike on Load Script Zeriab 3 11,286 05-14-2017, 06:25 PM
Last Post: LiTTleDRAgo
   Character Select Script Selwyn 3 10,739 03-07-2017, 04:14 AM
Last Post: JayRay
   ELSA (Event Layering Script Advance) JayRay 0 6,018 02-25-2015, 04:15 AM
Last Post: JayRay



Users browsing this thread: 2 Guest(s)