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.

Title Screen Animation

Use this:
Code:
class Scene_Title
  def main
    if $BTEST
      battle_test
      return
    end
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @background_images = ["1","2","3","4","5","6"] # Change here the names of 
                                                   # yours backgrounds
    @background_image_index = 0
    @background_image_time_max = 20 # Change here the time that will be waited 
                                    # until changing the backgroung image
    @background_image_time = @background_image_time_max
    @sprite = Sprite.new
    @sprite.x = -640
    @sprite.y = -480
    @sprite.bitmap = RPG::Cache.title(@background_images[0])
    s1 = "New Game"
    s2 = "Continue"
    s3 = "Shutdown"
    @command_window = Window_Command.new(192, [s1, s2, s3])
    @command_window.back_opacity = 160
    @command_window.x = 640 - @command_window.width
    @command_window.y = 240 - @command_window.height / 2
    @command_window.opacity = 0
    @command_window.back_opacity = 0
    @command_window.contents_opacity = 0
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    Audio.bgm_stop
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
    Audio.se_play("Audio/SE/" + "***", 100, 100) # Change *** to the sound you 
                                                 # want
    x = -640
    until @sprite.y == 0
      @background_image_time -= 1
      if @background_image_time == 0
        @background_image_time = @background_image_time_max
        @background_image_index += 1
        @background_image_index = 0 if @background_image_index == 6
        @sprite.bitmap = RPG::Cache.title(@background_images[@background_image_index])
      end
      x += 1.33
      @sprite.x = x
      @sprite.y += 1
      Graphics.update
    end
    until @command_window.contents_opacity == 255
      @background_image_time -= 1
      if @background_image_time == 0
        @background_image_time = @background_image_time_max
        @background_image_index += 1
        @background_image_index = 0 if @background_image_index == 6
        @sprite.bitmap = RPG::Cache.title(@background_images[@background_image_index])
      end
      @command_window.opacity += 5
      @command_window.back_opacity += 5
      @command_window.contents_opacity += 5
      Graphics.update
    end
    $game_system.bgm_play($data_system.title_bgm)
    while $scene == self
      @background_image_time -= 1
      if @background_image_time == 0
        @background_image_time = @background_image_time_max
        @background_image_index += 1
        @background_image_index = 0 if @background_image_index == 6
        @sprite.bitmap = RPG::Cache.title(@background_images[@background_image_index])
      end
      Graphics.update
      Input.update
      update
    end
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end
end
I don't understand well your specifications, so if the script have something bad, I will change it.
 

Jason

Awesome Bro

@ vgvgf
Where this is:
@background_images = ["1","2","3","4","5","6"]
Can you put them in any order?, Like this:
@background_images = ["2","5","1","6","3","4"]
And it will play them in that order ? And do I have to name my pictures, 1, 2, 3, 4, 5, and 6 ?
 
@> jbrist:
Code:
@background_images = ["2","5","1","6","3","4"]
If you use that, the order will be: 2, 5, 1, 6, 3, 4, 2, 5, 1, 6, 3, 4, 2, ...
You can name the pictures whit what you want, like:
Code:
@background_images = ["A","Picture","Title","0","Frame5","asdgasf"]
But you need to put the pictures with the names youselect in the folder "Graphics/Titles".

You can too, change the "6", to the max cant of pictures that do you want to be displayed:(There are 3 places to change the "6", be sure to change all)
Code:
@background_image_index = 0 if @background_image_index == 6

So, if you put a 10:
Code:
@background_image_index = 0 if @background_image_index == 10
You can put 10 images:
Code:
@background_images = ["1","2","3","4","5","6","7","8","9","10"]
 

Jason

Awesome Bro

Wow, sounds cool !
Just another question, Do I replace Scene_Title with this ? or Put it above main and forget about it ?


P.S - I tried it in both places, and even beow Scene_Title, and my Titlescreen won't load, but I can hear the BGM, Can this be fixed ?
 
Just another question, Do I replace Scene_Title with this ? or Put it above main and forget about it ?
Put avobe main, or only replace the definition main in Scene_Title.

Code:
P.S - I tried it in both places, and even beow Scene_Title, and my Titlescreen won't load, but I can hear the BGM, Can this be fixed ?
Why it does not work?
It works for me, see this demo: Project16.rar
 

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