Wyn Engine Ace -Splash Scene Script

Wyn Wizard

Arcane Specialist
Veteran
Joined
Feb 23, 2013
Messages
979
Reaction score
80
First Language
English
Primarily Uses
RMVXA
Wyn Engine Ace - Splash Scene Version 1.0
by Wyn Wizard

Introduction:
This script allows the user to add a splash screen to their game. While most games do not need one, it is a good resource to have if you want to displays your sponsors, the teams who helped you create you game, or if you want to display your own logo. This script is plug and play with little actual set up.


Features:
This script provides the users game with a splash screen that is very customizable. While there is only one animation, there will be more to come in later versions. Also allows the user to play their title track during the splash scene and straight into the title scene with no pauses or stops.

How to Use:
1.) Place script under the section labeled "Materials" in the script editor.
2.) Navigate to the editable region of the script. Explicit directions and warning are given there. NOTE: Make sure all file names and paths match. Ruby is a very case-sensitive language meaning "teXtfile.txt' does not equal "textfile.txt". Also remember to place all music in the game's Audio/BGM folder and all pictures you wish to display during the splash scene in the game's Graphics/Pictures folder. If you do not, the script will error and will cause the game to fail.

Script:
Code:
#===============================================================================
# Author: Wyn Wizard
# Supporting Authors: Dekita
# Email: eugenepetrie@live.com
# Title: Wyn Engine Ace - Splash Scene
# Creation Date: 2/16/2017
# Version: 1.0
#===============================================================================
# KNOWN BUGS:
# None
#-------------------------------------------------------------------------------
# WARNING:
# This script does alias and overwrite some parts of the Scene_Title. Please be
# aware that this can, and probably will, cause a conflict with any other
# scripts that also change Scene_Title. Please use at your own caution.
#-------------------------------------------------------------------------------
# UPDATES:
# 1.) Made this one stand alone. Core script no longer needed.
#-------------------------------------------------------------------------------
# INSTRUCTIONS:
# 1.) This script must be placed below the DMEA Core Script in order for it to
#     run properly.
# 2.) This script is fairy flexible, and the editable region is fairly easy to
#     follow.
#     The Scenes array is broken into a set of hashs that incude:
#     name of the picture file wanted to be shown, picture's "hang" on
#     the screen, and then its fade speeds. You can create more than one scene.
#     To do this, go to the last scene in the Splash_Settings module and add a
#     "," to it. Then insert this into a new line:
#     {:name => "file_name, :hang => frames, :fade => [fade_in, fade_out]}
#       - The file name is the name of the picture
#       - The frames tells the scene how long to hold the picture on the scene
#         [60 frames = 1 sec]
#       - The fade in speed controls the oppacity of the picture's incremement
#         speed which makes the picture appear on the screen.
#       - The fade out speed controls the oppacity of the picture's decremement
#         speed which makes the picture disappear from the screen
#
# If any errors occur, please feel free to email me at eugenepetrie@live.com,
# or pm me, Wyn Wizard.
#-------------------------------------------------------------------------------
# TERMS AND CONDITIONS:
# 1.) You must credit Wyn Wizard and Dekita if you use this script or this
#     engine.
# 2.) This script and engine is free for non comercial games.
# 3.) This script and engine is not free for commercial games. If you want to
#     this engine in a comercial game, pm me since i am the main code master.
# 4.) Do not claim this script as your own. I know my coding style, and I will
#     persue legal actions.
#===============================================================================
# Version: At the moment, this is not needed. May be needed in future releases.
($imported||={})[:Wyn_Splash] = 1.1
#===============================================================================
# ■ EDITABLE REGION
#===============================================================================
module WEA
  module Splash_Settings
    Scenes = [
      # [name of picture, how long the picture stays]
      {:name => "studio_logo", :hang => 60},
    ]
    Fade_in_speed = 2
    Fade_out_speed = 4
    Sounds = {
      :title      => ["Audio/BGM/" + "Theme5", 80, 100]
    }
    #---------------------------------------------------------------------------
    # ■ Play BGM
    #---------------------------------------------------------------------------
    def self.play_bgm(key)
      Audio.bgm_play(*Sounds[key])
    end
  end
end
#===============================================================================
# DO NOT EDIT BELOW HERE!
# EDITING BELOW HERE MAY RESULT IN, BUT NOT RESTRICTED TO: NAUSEA, VOMITING,
# EXPLOSIVE DIARRHEA, IMPLOSIVE DIARRHEA, DEMINSIA, LOSS OF: VISION, HEARING,
# FEELING IN YOUR LEFT LEG, OR HAIR.
#===============================================================================
# ** SceneManager
#-----------------------------------------------------------------------------
#  This module manages scene transitions. For example, it can handle
# hierarchical structures such as calling the item screen from the main menu
# or returning from the item screen to the main menu.
#=============================================================================
class << SceneManager
  #---------------------------------------------------------------------------
  # * Get First Scene Class
  #---------------------------------------------------------------------------
  def first_scene_class
    $BTEST ? Scene_Battle : Scene_Splash
  end
end
#=============================================================================
# ** Splash Scene
#-----------------------------------------------------------------------------
#  This class holds the fucntionality that runs the splash scene before the
#   screen runs.
#=============================================================================
class Scene_Splash < Scene_Base
  #---------------------------------------------------------------------------
  # ■ Start Method
  #---------------------------------------------------------------------------
  def start
    super
    WEA::Splash_Settings::play_bgm(:title)
    @sprite = Sprite.new(@viewport)
    @splash_scenes = WEA::Splash_Settings::Scenes.compact()
    @splash_scene_id = 0
    @fade_in_speed = WEA::Splash_Settings::Fade_in_speed
    @fade_out_speed = WEA::Splash_Settings::Fade_out_speed
    reset_splash()
  end
  #---------------------------------------------------------------------------
  # ■ Reset Splash Scene Method
  #---------------------------------------------------------------------------  
  def reset_splash
    data = @splash_scenes[@splash_scene_id]
    return unless data
    @stage = :fade_in
    @stage_opacity = 0
    @mid_hang = data[:hang]
    @sprite.bitmap = Cache.picture(data[:name])
    @sprite.opacity = @stage_opacity
    @sprite_center_x = Graphics.width/2 - (@sprite.width/2)
    @sprite_center_y = Graphics.height/2 - (@sprite.height/2)
    @sprite.x = @sprite_center_x
    @sprite.y = @sprite_center_y
    @sprite.zoom_x = (@sprite.zoom_y = 1.0)
  end
  #---------------------------------------------------------------------------
  # ■ Update Method
  #---------------------------------------------------------------------------  
  def update
    super
    case @stage
      when :fade_in  then @stage_opacity += @fade_in_speed
        @stage = :fade_mid if @stage_opacity >= 255
      when :fade_mid  then @mid_hang -= 1
        @stage = :fade_out if @mid_hang <= 0
      when :fade_out then @stage_opacity -= @fade_out_speed
        @sprite.zoom_x = (@sprite.zoom_y -= 0.001)
        @sprite_center_x = Graphics.width/2 - ((@sprite.width * @sprite.zoom_x)/2)
        @sprite_center_y = Graphics.height/2 - ((@sprite.height * @sprite.zoom_y)/2)
        @sprite.x = @sprite_center_x
        @sprite.y = @sprite_center_y
        @stage = :end if @stage_opacity <= 0
      when :end then update_stage_id()
    end
    @sprite.opacity = @stage_opacity
  end
  #---------------------------------------------------------------------------
  # ■ Update Stage ID Method
  #---------------------------------------------------------------------------  
  def update_stage_id
    if (@splash_scene_id == @splash_scenes.size())
      SceneManager.call(Scene_Title)
    else
      @splash_scene_id += 1
      reset_splash()
    end
  end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#------------------------------------------------------------------------------
# Functions Overwritten: 1
# Functions Aliased: 14
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  alias :wea_splash_title_start start
  def start
    wea_splash_title_start()
  end
  #--------------------------------------------------------------------------
  # * Get Transition Speed
  #--------------------------------------------------------------------------
  alias :wea_splash_title_speed transition_speed
  def transition_speed
    wea_splash_title_speed()
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias :wea_splash_title_terminate terminate
  def terminate
    wea_splash_title_terminate()
  end
  #--------------------------------------------------------------------------
  # * Create Background
  #--------------------------------------------------------------------------
  alias :wea_splash_title_createBackground create_background
  def create_background
    wea_splash_title_createBackground()
  end
  #--------------------------------------------------------------------------
  # * Create Foreground
  #--------------------------------------------------------------------------
  alias :wea_splash_title_createForeground create_foreground
  def create_foreground
    wea_splash_title_createForeground()
  end
  #--------------------------------------------------------------------------
  # * Draw Game Title
  #--------------------------------------------------------------------------
  alias :wea_splash_title_drawGameTitle draw_game_title
  def draw_game_title
    wea_splash_title_drawGameTitle
  end
  #--------------------------------------------------------------------------
  # * Free Background
  #--------------------------------------------------------------------------
  alias :wea_splash_title_disposeBackground dispose_background
  def dispose_background
    wea_splash_title_disposeBackground()
  end
  #--------------------------------------------------------------------------
  # * Free Foreground
  #--------------------------------------------------------------------------
  alias :wea_splash_title_disposeForeground dispose_foreground
  def dispose_foreground
    wea_splash_title_disposeForeground()
  end
  #--------------------------------------------------------------------------
  # * Move Sprite to Screen Center
  #--------------------------------------------------------------------------
  alias :wea_splash_title_centerSprite center_sprite
  def center_sprite(sprite)
    wea_splash_title_centerSprite(sprite)
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  alias :wea_splash_title_createCMDWin create_command_window
  def create_command_window
    wea_splash_title_createCMDWin()
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  alias :wea_splash_title_closeCMDWin close_command_window
  def close_command_window
    wea_splash_title_closeCMDWin()
  end
  #--------------------------------------------------------------------------
  # * [New Game] Command
  #--------------------------------------------------------------------------
  alias :wea_splash_title_newGameCMD command_new_game
  def command_new_game
    wea_splash_title_newGameCMD()
  end
  #--------------------------------------------------------------------------
  # * [Continue] Command
  #--------------------------------------------------------------------------
  alias :wea_splash_title_continueCMD command_continue
  def command_continue
    wea_splash_title_continueCMD()
  end
  #--------------------------------------------------------------------------
  # * [Shut Down] Command
  #--------------------------------------------------------------------------
  alias :wea_splash_title_shutdownCMD command_shutdown
  def command_shutdown
    wea_splash_title_shutdownCMD()
  end
  #--------------------------------------------------------------------------
  # * Play Title Screen Music
  #--------------------------------------------------------------------------
  def play_title_music
    # Overwritten method to allow the music from the splash screen to continue.
  end
end #end script
#==============================================================================#
# ** Script created by Wyn Wizard **                                           #
#==============================================================================#

FAQ:
Q: The game gives this error when it starts: "Unable to find file: Audio/BGM/file_name".
A: Make sure you have the file in the game's Audio/BGM folder and that both the file name there and the file name on the script's editable region match.

Q: The game gives this error when it starts: "Unable to find file: Graphics/Pictures/file_name".
A: Make sure you have the file in the game's Graphics/Pictures folder and that both the file name there and the file name on the script's editable region match.

Credits:
- Eugene Petrie (Wyn Wizard)
- Dekita

 
Last edited:

Arcmagik

Game Developer
Veteran
Joined
Sep 27, 2015
Messages
514
Reaction score
675
First Language
English
Primarily Uses
RMMV
Excellent work! I'll be looking for this when I get around to that part of my game!
 

Wyn Wizard

Arcane Specialist
Veteran
Joined
Feb 23, 2013
Messages
979
Reaction score
80
First Language
English
Primarily Uses
RMVXA
@Arcmagik Thank you! Let me know when you get your project done!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top