How to Use a GIF for Your Title Screen

How to Use a GIF for Your Title Screen

Have you ever wanted to use a GIF as your title screen but realized essentials doesn't support this for some reason? Well I have the method for you right here!

MAJOR WARNING: SAVE YOUR GIF TITLED "splash" TO THE "Pictures" FOLDER AND NOT "Titles". FAILING TO DO SO WILL RESULT IN A BLACK SCREEN.

Now with that out of the way, let's get on with the script!

First, replace the entirety of Scene_Intro with this:

Ruby:
class IntroEventScene < EventScene
  def initialize(pics)
    super(nil)
    @pics=pics
    @pic=addBitmap(0,0,"")
    @pic.moveOpacity(0,0,0) # fade to opacity 0 in 0 frames after waiting 0 frames
    @pic2=addImage(0,322,"") # flashing "Press Enter" picture
    @pic2.moveOpacity(0,0,0)
    @index=0
    data_system = pbLoadRxData("Data/System")
    pbBGMPlay(data_system.title_bgm)
    openPic(self,nil)
  end


  def openPic(scene,args)
    onCTrigger.clear
    @pic.name="Graphics/Titles/"+@pics[@index]
    @pic.moveOpacity(15,0,255) # fade to opacity 255 in 15 frames after waiting 0 frames
    pictureWait
    @timer=0 # reset the timer
    onUpdate.set(method(:timer)) # call timer every frame
    onCTrigger.set(method(:closePic)) # call closePic when C key is pressed
  end

  def timer(scene,args)
    @timer+=1
    if @timer>80
      @timer=0
      closePic(scene,args) # Close the picture
    end
  end

  def closePic(scene,args)
    onCTrigger.clear
    onUpdate.clear
    @pic.moveOpacity(15,0,0)
    pictureWait
    @index+=1 # Move to the next picture
    if @index>=@pics.length
      openSplash(scene,args)
    else
      openPic(scene,args)
    end
  end

    def pbUpdate
    pbUpdateSpriteHash(@sprites)
  end

  def openSplash(scene,args)
    onCTrigger.clear
    onUpdate.clear
    @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
    @pic2.name="Graphics/Titles/start"
    @pic2.moveOpacity(15,0,255)
    @sprites = {}
    addBackgroundPlane(@sprites,"background","splash",@viewport)
    pbFadeInAndShow(@sprites) { pbUpdate }
    onUpdate.set(method(:splashUpdate))# call splashUpdate every frame
    onCTrigger.set(method(:closeSplash))# call closeSplash when C key is pressed
  end

  def splashUpdate(scene,args)
      pbUpdateSpriteHash(@sprites)
      @timer+=1
      @timer=0 if @timer>=80
      if @timer>=32
          @pic2.moveOpacity(0,0,8*(@timer-32))
      else
        @pic2.moveOpacity(0,0,255-(8*@timer))
      end
      if Input.press?(Input::DOWN) &&
         Input.press?(Input::B) &&
         Input.press?(Input::CTRL)
        closeSplashDelete(scene,args)
      end
    end

  def closeSplash(scene,args)
    onCTrigger.clear
    onUpdate.clear
    # Play random cry
    cry=pbCryFile(1+rand(PBSpecies.maxValue))
    pbSEPlay(cry,80,100) if cry
    # Fade out
    @pic2.moveOpacity(10,0,0)
    pbFadeOutAndHide(@sprites) { pbUpdate }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
    pbBGMStop(1.0)
  #  pictureWait
    scene.dispose # Close the scene
    sscene=PokemonLoad_Scene.new
    sscreen=PokemonLoadScreen.new(sscene)
    sscreen.pbStartLoadScreen
  end

  def closeSplashDelete(scene,args)
    onCTrigger.clear
    onUpdate.clear
    # Play random cry
    cry=pbCryFile(1+rand(PBSpecies.maxValue))
    pbSEPlay(cry,80,100) if cry
    # Fade out
    @pic2.moveOpacity(10,0,0)
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
    pbBGMStop(1.0)
   # pictureWait
    scene.dispose # Close the scene
    sscene=PokemonLoad_Scene.new
    sscreen=PokemonLoadScreen.new(sscene)
    sscreen.pbStartDeleteScreen
  end
end

class Scene_Intro
  def initialize(pics)
    @pics=pics
  end

  def main
    Graphics.transition(0)
    @eventscene=IntroEventScene.new(@pics)
    @eventscene.main
    Graphics.freeze
  end
end
Next. go to Main Yes, you have to edit main for this script and find this line:

Ruby:
def pbCallTitle
  if $DEBUG
    return Scene_DebugIntro.new
  else
    # First parameter is an array of images in the Titles
    # directory without a file extension, to show before the
    # actual title screen.  Second parameter is the actual
    # title screen filename, also in Titles with no extension.
    return Scene_Intro.new(['intro1'], 'splash')
  end
end
All you have to do here is remove the , 'splash' from the definition and everything should work! Enjoy!
Credits
Me ~ Credit is required
Author
Michael
First release
Last update
Rating
5.00 star(s) 3 ratings

More resources from Michael

Latest reviews

I love this, it's a very good idea use a gif on the title screen
This is awesome, Michael. 5 *s isn't enough, imo. I will be implementing this into my game sometime in the future.
It's awesome to just be able to use a simple gif for the title screen, especially when you just want to have a specific effect with minimal scripting.
Top