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.

[VX]Press Start - Text

Press Start - Text
Version 1.0
By Gando
Release Date: 25/5 - 2008


Introduction
You know where some games has a blinking "Press Start" text at the title screen of the game.
With this script you can also have that little feature!

This script is not really a big deal, i just thought it would be a nice little feature in the title screen of the game.

Features
•Customizable "Press Start" text.
•Customizable Decision sound.
•Customizable Cancel sound.
•The option to choose the duration of the disappearing/reappearing of the text.
•You can choose if you only want to display the text or a window with the text.


Script
Code:
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# By: Gando
# 25/5 2008
#------------------------------------------------------------------------------ 
#                                INTRODUCTION
#------------------------------------------------------------------------------
#
# This script will display a blinking "Press Start" text in the title screen.
#
#------------------------------------------------------------------------------
#                                    SETUP
#------------------------------------------------------------------------------
#
# Press_Wait - The higher this number is, the longer it will take before the 
#              text disappear/reappear.
#
# Text - This is the text that is being displayed.
#
# Press_Sound - Here you add the name of the SE sound that you want to have
#               when the player press the decision key.
#
# Return_Sound - Here you add the name of the SE sound that you want to have 
#                when the player press the cancel key.
#
# Text_Background_Opacity - Choose your opacity of your window, between 0-255.
#                         (0 = Transparent, anything higher will show the window)
# 
#------------------------------------------------------------------------------
#  CREDITS: Gando.
#==============================================================================

Press_Wait = 100
Text = "Press Start"
Press_Sound = "Decision2"
Return_Sound = "Cancel"
Text_Background_Opacity = 0

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    if $BTEST                         # If battle test
      battle_test                     # Start battle test
    else                              # If normal play
      super                           # Usual main processing
    end
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    load_database                     # Load database
    create_game_objects               # Create game objects
    check_continue                    # Determine if continue is enabled
    create_title_graphic              # Create title graphic
    create_command_window             # Create command window
    play_title_music                  # Play title screen music
    create_press_start
  end
  #--------------------------------------------------------------------------
  # * Execute Transition
  #--------------------------------------------------------------------------
  def perform_transition
    Graphics.transition(20)
  end
  #--------------------------------------------------------------------------
  # * Post-Start Processing
  #--------------------------------------------------------------------------
  def post_start
    super
    close_command_window
  end
  #--------------------------------------------------------------------------
  # * Pre-termination Processing
  #--------------------------------------------------------------------------
  def pre_terminate
    super
    close_command_window
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_command_window
    snapshot_for_background
    dispose_title_graphic
    dispose_press_start
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @command_window.update
    @window_start.update
    if @command_window.active
      if Input.trigger?(Input::C)
        case @command_window.index
        when 0    #New game
          command_new_game
        when 1    # Continue
          command_continue
        when 2    # Shutdown
          command_shutdown
        end
      end
    end
    
    if @window_start.active
      if @gando > 0
        @gando -= 1
      end

      if @gando > (Press_Wait / 2)
        @window_start.visible = true
      else
        @window_start.visible = false
      end
      if @gando == 0
        start_restore
      end
    end
    if @window_start.active
      if Input.trigger?(Input::C)
        Audio.se_play("Audio/SE/" + Press_Sound, 80, 100)
        @window_start.active = false
        @window_start.visible = false
        @command_window.active = true
        @command_window.visible = true
        open_command_window
      end
    end
    if Input.trigger?(Input::B)
      Audio.se_play("Audio/SE/" + Return_Sound, 80, 100)
      close_command_window
      @window_start.active = true
      @window_start.visible = true
      @command_window.active = false
      @command_window.visible = false
    end
    
  end
  
  #--------------------------------------------------------------------------
  # * Start_Restore
  #--------------------------------------------------------------------------
  def start_restore
    @gando = Press_Wait
  end
  #--------------------------------------------------------------------------
  # * Load Database
  #--------------------------------------------------------------------------
  def load_database
    $data_actors        = load_data("Data/Actors.rvdata")
    $data_classes       = load_data("Data/Classes.rvdata")
    $data_skills        = load_data("Data/Skills.rvdata")
    $data_items         = load_data("Data/Items.rvdata")
    $data_weapons       = load_data("Data/Weapons.rvdata")
    $data_armors        = load_data("Data/Armors.rvdata")
    $data_enemies       = load_data("Data/Enemies.rvdata")
    $data_troops        = load_data("Data/Troops.rvdata")
    $data_states        = load_data("Data/States.rvdata")
    $data_animations    = load_data("Data/Animations.rvdata")
    $data_common_events = load_data("Data/CommonEvents.rvdata")
    $data_system        = load_data("Data/System.rvdata")
    $data_areas         = load_data("Data/Areas.rvdata")
  end
  #--------------------------------------------------------------------------
  # * Load Battle Test Database
  #--------------------------------------------------------------------------
  def load_bt_database
    $data_actors        = load_data("Data/BT_Actors.rvdata")
    $data_classes       = load_data("Data/BT_Classes.rvdata")
    $data_skills        = load_data("Data/BT_Skills.rvdata")
    $data_items         = load_data("Data/BT_Items.rvdata")
    $data_weapons       = load_data("Data/BT_Weapons.rvdata")
    $data_armors        = load_data("Data/BT_Armors.rvdata")
    $data_enemies       = load_data("Data/BT_Enemies.rvdata")
    $data_troops        = load_data("Data/BT_Troops.rvdata")
    $data_states        = load_data("Data/BT_States.rvdata")
    $data_animations    = load_data("Data/BT_Animations.rvdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rvdata")
    $data_system        = load_data("Data/BT_System.rvdata")
  end
  #--------------------------------------------------------------------------
  # * Create Game Objects
  #--------------------------------------------------------------------------
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
  end
  #--------------------------------------------------------------------------
  # * Determine if Continue is Enabled
  #--------------------------------------------------------------------------
  def check_continue
    @continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
  end
  #--------------------------------------------------------------------------
  # * Create Title Graphic
  #--------------------------------------------------------------------------
  def create_title_graphic
    @sprite = Sprite.new
    @sprite.bitmap = Cache.system("Title")
  end
  #--------------------------------------------------------------------------
  # * Dispose of Title Graphic
  #--------------------------------------------------------------------------
  def dispose_title_graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::new_game
    s2 = Vocab::continue
    s3 = Vocab::shutdown
    @command_window = Window_Command.new(172, [s1, s2, s3])
    @command_window.x = (544 - @command_window.width) / 2
    @command_window.y = 288
    @command_window.active = false
    @command_window.visible = false
    if @continue_enabled                    # If continue is enabled
      @command_window.index = 1             # Move cursor over command
    else                                    # If disabled
      @command_window.draw_item(1, false)   # Make command semi-transparent
    end
    @command_window.openness = 0
    @command_window.open
  end
  
  #--------------------------------------------------------------------------
  # * Create "Press Start" window
  #--------------------------------------------------------------------------
  def create_press_start
    @gando = Press_Wait               
    @window_start = Window_Start.new  # Make "Press Start" window
    @window_start.opacity = Text_Background_Opacity # Assign the window opacity.
    
  end
  #--------------------------------------------------------------------------
  # * Dispose of Command Window
  #--------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Dispose of Press start
  #--------------------------------------------------------------------------
  def dispose_press_start
    @window_start.dispose
  end
  #--------------------------------------------------------------------------
  # * Open Command Window
  #--------------------------------------------------------------------------
  def open_command_window
    @command_window.open
    begin
      @command_window.update
      Graphics.update
    end until @command_window.openness == 255
  end
  #--------------------------------------------------------------------------
  # * Close Command Window
  #--------------------------------------------------------------------------
  def close_command_window
    @command_window.close
    begin
      @command_window.update
      Graphics.update
    end until @command_window.openness == 0
  end
  #--------------------------------------------------------------------------
  # * Play Title Screen Music
  #--------------------------------------------------------------------------
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end
  #--------------------------------------------------------------------------
  # * Check Player Start Location Existence
  #--------------------------------------------------------------------------
  def confirm_player_location
    if $data_system.start_map_id == 0
      print "Player start location not set."
      exit
    end
  end
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    confirm_player_location
    Sound.play_decision
    $game_party.setup_starting_members            # Initial party
    $game_map.setup($data_system.start_map_id)    # Initial map position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    close_command_window
    Graphics.fadeout(60)
    Graphics.wait(40)
    Graphics.frame_count = 0
    RPG::BGM.stop
    $game_map.autoplay
  end
  #--------------------------------------------------------------------------
  # * Command: Continue
  #--------------------------------------------------------------------------
  def command_continue
    if @continue_enabled
      Sound.play_decision
      $scene = Scene_File.new(false, true, false)
    else
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # * Command: Shutdown
  #--------------------------------------------------------------------------
  def command_shutdown
    Sound.play_decision
    RPG::BGM.fade(800)
    RPG::BGS.fade(800)
    RPG::ME.fade(800)
    $scene = nil
  end
  #--------------------------------------------------------------------------
  # * Battle Test
  #--------------------------------------------------------------------------
  def battle_test
    load_bt_database                  # Load battle test database
    create_game_objects               # Create game objects
    Graphics.frame_count = 0          # Initialize play time
    $game_party.setup_battle_test_members
    $game_troop.setup($data_system.test_troop_id)
    $game_troop.can_escape = true
    $game_system.battle_bgm.play
    snapshot_for_background
    $scene = Scene_Battle.new
  end
end

#==============================================================================
# ** Window_Start
#------------------------------------------------------------------------------
#  
#==============================================================================
class Window_Start < Window_Base
  
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(210, 300, 130, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    refresh
  end
  
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    
    self.contents.draw_text(0, -45, 100, 100, Text, 0)
  end
end
Insert the script in an empty slot above main.

Screenshots
Before you press the start button there is a text appearing/disappearing about every other second:
http://i244.photobucket.com/albums/gg9/ ... tart-1.png[/img]

And after you press the start button the command window becomes active:
http://i244.photobucket.com/albums/gg9/ ... tart-2.png[/img]

Author's Notes
You are free to use this script in any of your games.
If you wish to redistribute this script to any other forum please link to this topic.

Credit
Credit goes to me.
 
Ehm.. this might be a stupid question, but did you use this script in a XP project?
Because this script is for VX ^^
 
Can be a chair":1wco3toe said:
It will be nicer if u put to appear an image, and not the boring text =/
Gando":1wco3toe said:
Okay, as you wish.
Updated the topic with pictures!

Gando, I think Can Be A Chair was suggesting the ability to use an image in place of the Press Start text, rather than using plain text as the "Press Start" logo. Know what I mean?
 
Can you do the Press Start at the Middle ........................
Im waiting you Gando 

Credit
Credit goes to Gando.....................
I take you text
 
This may sound like I'm a mini-moderator but you've necroposted... anyway here's the change you needed.

Go all the way to the bottom of the script.
Look at Window_Start

change this line:
Code:
super(210, 300, 130, 50)

to this:
Code:
super(210, 175, 130, 50)
 

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