Help - Search - Members - Calendar
Full Version: Super Simple Splash Screen
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
amaranth
I'm moving all of my scripts from rmxp.org to this site. I like it here better.

Introduction
This is a really simple splash screen for you. When you use this, two splash screens will appear when you open your game.

Steps
1. Open Main and change Scene_Title.new to Scene_Splash.new.
CODE
  $scene = Scene_Splash.new


2. Put two graphics called Intro-1.png and Intro-2.png into your project's \Graphics\Pictures folder.

(note: these graphics can also be jpgs, gifs, or bmps... it really depends upon your preference)


3. Add this Scene_Splash script above Main:
CODE
#------------------------------------------------------------------------
# Show two splashscreens when your game loads
#------------------------------------------------------------------------
class Scene_Splash
  
#--------------------------------------------------------------------------
# ● Initialize the scene
#--------------------------------------------------------------------------  
def main
  
# Load the System database & create a new game  
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new

# Initialize some transition stuff
@show = true
@hide = false
@n = 0
@splash_numb = 2

# Define info about each splash screen
@sprite1 = Sprite.new
@sprite1.bitmap = RPG::Cache.picture("Intro-1")
@sprite1.opacity = 0

@sprite2 = Sprite.new
@sprite2.bitmap = RPG::Cache.picture("Intro-2")
@sprite2.opacity = 0

# Update graphics and input
Graphics.transition
loop do
   Graphics.update
   Input.update
   update
   if $scene != self
     break
   end
end

# Discard your graphics when you leave this scene
Graphics.freeze
@sprite1.dispose
@sprite2.dispose
  
end

#--------------------------------------------------------------------------
# ● Update the contents in this scene
#--------------------------------------------------------------------------

def update
  
   # If SPACEBAR is pressed, go to to title screen
   if Input.trigger?(Input::C)
      $scene = Scene_Title.new
   end
  
   # Change the opacity of the graphics
   transition
  
   # Update graphics
   @sprite1.update
   @sprite2.update
  
end
  
#--------------------------------------------------------------
# Transition through splash screens
#--------------------------------------------------------------  
def transition
        
      # Fade in a splashscreen
      if @show == true
         @n += 2
         if @n > 255
           @hide = true
           @show = false
           @n = 255
         end
       end
      
      # Fade out a splashscreen and load the next one
      if @hide == true
         @n -= 2
         if @n < 0
           @hide = false
           @show = true
           @splash_numb -= 1
           @n = 0
         end
       end      
      
      # Choose which action to perform in this scene
      case @splash_numb      
        when 0
          $scene = Scene_Title.new
        when 1
          @sprite2.opacity = @n
        when 2
          @sprite1.opacity = @n
      end      
      
end


end


4. Play your game!
ShadowKing55
If I only have Intro-1.png will it show another blank screen?
amaranth
It will crash. Delete everything for splash2, change @splash_numb = 2 to @splash_numb = 1. In case @splash_numb, make sure you put splash1 under case 1, not case 2.
ShadowKing55
If you're not to busy, could you do it to where there is only one? I would try like you said but I know nothing of scripting.
amaranth
Sure. Here you go:

CODE
#------------------------------------------------------------------------
# Show one splashscreens when your game loads
#------------------------------------------------------------------------
class Scene_Splash
  
#--------------------------------------------------------------------------
# ● Initialize the scene
#--------------------------------------------------------------------------  
def main
  
# Load the System database & create a new game  
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new

# Initialize some transition stuff
@show = true
@hide = false
@n = 0
@splash_numb = 1

# Define info about each splash screen
@sprite1 = Sprite.new
@sprite1.bitmap = RPG::Cache.picture("Intro-1")
@sprite1.opacity = 0

# Update graphics and input
Graphics.transition
loop do
   Graphics.update
   Input.update
   update
   if $scene != self
     break
   end
end

# Discard your graphics when you leave this scene
Graphics.freeze
@sprite1.dispose
  
end

#--------------------------------------------------------------------------
# ● Update the contents in this scene
#--------------------------------------------------------------------------

def update
  
   # If SPACEBAR is pressed, go to to title screen
   if Input.trigger?(Input::C)
      $scene = Scene_Title.new
   end
  
   # Change the opacity of the graphics
   transition
  
   # Update graphics
   @sprite1.update
  
end
  
#--------------------------------------------------------------
# Transition through splash screens
#--------------------------------------------------------------  
def transition
        
      # Fade in a splashscreen
      if @show == true
         @n += 2
         if @n > 255
           @hide = true
           @show = false
           @n = 255
         end
       end
      
      # Fade out a splashscreen and load the next one
      if @hide == true
         @n -= 2
         if @n < 0
           @hide = false
           @show = true
           @splash_numb -= 1
           @n = 0
         end
       end      
      
      # Choose which action to perform in this scene
      case @splash_numb      
        when 0
          $scene = Scene_Title.new
        when 1
          @sprite1.opacity = @n
      end      
      
end


end
ShadowKing55
tyvm ^^
Thelozeldaman
Awesome script! Can't wait to use it.
Momo_san
Want to try it for myself..
Thanx wink.gif
Redd
Very nice. I've used this somewhere before, probably .org, but I will use it definetely!

EDIT: Shadowking55... your sig scared the shit outta me.
Momo_san
I already put in my game project,and it worked just totally fine!! laugh.gif
Than'x a lot wink.gif
DespairReigns
Is there a way for it to start playing the beginning BGM while the first splash is showing?
Please and thank you XD
handy333
Is it possible to change the x and y values of a small picture?
brewmeister
slightly modified. Will center each picture. (added lines 25-26, 31-32)

CODE
#------------------------------------------------------------------------
# Show two splashscreens when your game loads
# 27Aug09 Brew Modified to Center Images
#------------------------------------------------------------------------
class Scene_Splash

#--------------------------------------------------------------------------
# ● Initialize the scene
#--------------------------------------------------------------------------
def main

# Load the System database & create a new game
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new

# Initialize some transition stuff
@show = true
@hide = false
@n = 0
@splash_numb = 2

# Define info about each splash screen
@sprite1 = Sprite.new
@sprite1.bitmap = RPG::Cache.picture("Intro-1")
@sprite1.opacity = 0
@sprite1.x = 320 - @sprite1.bitmap.width / 2
@sprite1.y = 240 - @sprite1.bitmap.height / 2

@sprite2 = Sprite.new
@sprite2.bitmap = RPG::Cache.picture("Intro-2")
@sprite2.opacity = 0
@sprite2.x = 320 - @sprite2.bitmap.width / 2
@sprite2.y = 240 - @sprite2.bitmap.height / 2

# Update graphics and input
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end

# Discard your graphics when you leave this scene
Graphics.freeze
@sprite1.dispose
@sprite2.dispose

end

#--------------------------------------------------------------------------
# ● Update the contents in this scene
#--------------------------------------------------------------------------

def update

# If SPACEBAR is pressed, go to to title screen
if Input.trigger?(Input::C)
$scene = Scene_Title.new
end

# Change the opacity of the graphics
transition

# Update graphics
@sprite1.update
@sprite2.update

end

#--------------------------------------------------------------
# Transition through splash screens
#--------------------------------------------------------------
def transition

# Fade in a splashscreen
if @show == true
@n += 2
if @n > 255
@hide = true
@show = false
@n = 255
end
end

# Fade out a splashscreen and load the next one
if @hide == true
@n -= 2
if @n < 0
@hide = false
@show = true
@splash_numb -= 1
@n = 0
end
end

# Choose which action to perform in this scene
case @splash_numb
when 0
$scene = Scene_Title.new
when 1
@sprite2.opacity = @n
when 2
@sprite1.opacity = @n
end

end


end
Zeffa
Sick, I'll be using this script. Will give credit in... Well... The credits.

Thanks again!
dorky106
Unable to find file Data/System.rxdata
can i get help with this?
Seitei Son Goku
You know, I realized that the RPG Maker XP engine did not have a default method of an opening. You can't have a game without some type of opening showing the personal symbol or signature of the game creator! But this script solved all of that! Much obliged! cool.gif
gyashinero
Is there any way to display the splash for longer? It just kind of fades out as soon as it appears.
Night_Runner
@> gyashinero: Welcome to the forums smile.gif To put a pause in, somewhere about the middle of the code there's a snippet that reads:
CODE
      # Fade in a splashscreen
      if @show == true
         @n += 2
         if @n > 255
           @hide = true
           @show = false
           @n = 255
         end
       end


Change that to read:

CODE
      # Fade in a splashscreen
      if @show == true
         @n += 2
         if @n > 255
           # This is at full opacity, so we'll put a pause in!
           for i in 0..40      # For 40 frames
             Graphics.update    # Update the grahics (basically a pause)
           end
           @hide = true
           @show = false
           @n = 255
         end
       end


If you prefer to work in seconds instead of frames, change the 40 to 3 * Graphics.frame_rate which'll make it last 3 seconds smile.gif
EvillyElven
Question: Is it possible to have it play an SE or ME for each title?
Night_Runner
Answer: Yes; it is possible.

At the end of the script you'll find the code:
CODE
      # Choose which action to perform in this scene
      case @splash_numb      
        when 0
          $scene = Scene_Title.new
        when 1
          @sprite2.opacity = @n
        when 2
          @sprite1.opacity = @n
      end

What you can do is edit this to read as follows:
CODE
      # Choose which action to perform in this scene
      case @splash_numb      
        when 0
          $scene = Scene_Title.new
          Audio.me_stop
        when 1
          @sprite2.opacity = @n
          Audio.me_play("Audio/ME/Intro2Melody", 100, 100) if @n == 2 and @show
        when 2
          @sprite1.opacity = @n
          Audio.me_play("Audio/ME/Intro1Melody", 100, 100) if @n == 2 and @show
      end


Where "Audio/ME/Intro2Melody" is the melody you're trying to play, the first 100 is the volume, and the second 100 is the pitch smile.gif
EvillyElven
THANK YOU!

You rule!
Phantom0x0
When you say "Add Script Above Main" what does that mean exactly In the "Main" script of in the script above main? (Sorry noob to the scripting thing)
Night_Runner
In the script editor, along the left, scroll all the way to the bottom, and there is a space labeled Main. Right click on that main, select Insert, and paste the code on the right smile.gif

Don't worry about being a noob scripter, I've heard that question more times than I can think of smile.gif
vincent329
insted of useing a pic is there anyway to show like a video or something?
kudozus
QUOTE (dorky106 @ Oct 15 2009, 09:34 AM) *
Unable to find file Data/System.rxdata
can i get help with this?



I'm also receiving this error message when I try to play game with your script. Do you know how to correct?
Night_Runner
Data/System.rxdata is a very critical file for your game....
Do you have any other scripts in your game that effect the title screen (please provide links)?
Nof56
Great Script! Easy to set up and easy to use!
DoctorTodd
I'm having the same problem where it can't find System.rxdata as well I looked and it is there I'm using Rafidelis Title X - Version 2.0 as my title screen does any one know a solution?
Night_Runner
Would you be able to upload a demo of your game please?

I should point out that the copy of the Title X Script that I found was for RPG Maker VX, and this script is under the XP section...

( Although it looks like all you would have to do is to change the line
CODE
$data_system = load_data("Data/System.rxdata")

to
CODE
$data_system = load_data("Data/System.rvdata")

and it should translate to VX. )
DoctorTodd
QUOTE (Night_Runner @ Nov 26 2011, 06:14 AM) *
Would you be able to upload a demo of your game please?

I should point out that the copy of the Title X Script that I found was for RPG Maker VX, and this script is under the XP section...

( Although it looks like all you would have to do is to change the line
CODE
$data_system = load_data("Data/System.rxdata")

to
CODE
$data_system = load_data("Data/System.rvdata")

and it should translate to VX. )


Well now I feel like a idiot... dry.gif
Thanks for your help I found a different one which I like better. I should of looked to see if it was for vx or xp.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.