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.

Scrolling Gameover Credits

Ok, i've seen other versions, but i think they require too much... this one is pretty stripped down to require very little, just the text scroller script, and of course the game over script.

INSTRUCTIONS:

  • Make a directory in your game folder called Text
  • Open notepad and type out your game credits *use this thread for color controls and what not http://www.rmxp.org/forums/index.php?topic=19807.0
  • Paste the text scroll script above main but below debug
  • Place my modified gameover below the text scroll script but above main

No credit to me is necessary, as all i did was call someone else's script... please do credit dubealex for the text scroller script, as he wrote it, and don't think he'd want anyone using it without giving him his due...
also the instruction link for the text scroller script is the thread where i got the script from, its an edit by DerVVulfman  *don't want to get yelled at for not crediting people*

ok, here are the scripts....

SCRIPTS:

Code:
#==============================================================================
# ** Text Scroll Script
#------------------------------------------------------------------------------
# by dubealex
# version R4
# 04-26-2007
# Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
# COMPATABILITY:
#
# Due to the fact that only the default Scene_Map was used through an 'ALIAS'
# method, this system is highly compatible, even with SDK 2.2.
#
#==============================================================================


   #========================================================================
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #========================================================================

TS_FONTNAME = 'Tahoma'
TS_FONTSIZE = 24

#==============================================================================
# ** TS_Font
#------------------------------------------------------------------------------
#  This class handles the font for the Text Scrolling system
#==============================================================================
class TS_Font
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(fontname, fontsize)
    $tsf_fontname = fontname
    $tsf_fontname = TS_FONTNAME if fontname == nil
    $tsf_fontsize = fontsize
    $tsf_fontsize = TS_FONTSIZE if fontsize == nil
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end



#==============================================================================
# ** Text_Scroller
#------------------------------------------------------------------------------
#  This class performs enhanced text display processing.
#==============================================================================
class Text_Scroller
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize (file, opacity_scroll, opacity_bg, speed, live_scroll)
    # Read the text file
    text=IO.readlines("Text/#{file}")
    # Set Speed global value to speed
    $tss_speed = speed
    # Divide the screen height by the speed value
    $tss_iteration = 480.0 / speed
    # Set the size of the displayed text (from the file)
    $tss_sy = (text.size * 32) + 64
    # Set the scrolling text window, text... size & all
    $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
    $tss_scroll_window.opacity = opacity_scroll
    # Place the window at the bottom of the screen & etc
    $tss_scroll_window.z = 500
    $tss_scroll_window.x = 0
    $tss_scroll_window.y = 480
    # Set 'Y-Positioner' to use decimal values
    $tss_scroll_y_pos    = 480.0
    # Set the background, opacities & such
    $tss_bg_window = Window_bg.new
    $tss_bg_window.opacity = opacity_bg
    $tss_bg_window.z=400
    # Switch between 'live scroll' feature or regular
    case live_scroll 
    when 0  
      # Perform normal update
      update
    when 1  
      # Set to Live Scroll, and use the Scene_Map's Update
      $live_scroll = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Scroll through the estimated window size & place properly.
    for i in 0...(($tss_sy / 480.0) * $tss_iteration) + $tss_iteration
      $tss_scroll_y_pos -= $tss_speed
      $tss_scroll_window.y = $tss_scroll_y_pos.to_i
      Graphics.update
    end
    # Dispose of window & window background
    $tss_scroll_window.dispose
    $tss_bg_window.dispose
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------  
end



#==============================================================================
# ** Window_Scroll
#------------------------------------------------------------------------------
#  This window is used to display text for the scrolling display system
#==============================================================================
class Window_Scroll < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize (file, sx, sy)
    @sx=sx
    @sy=sy
    super(0, 0, sx, sy)
    self.contents = Bitmap.new(width - 32, height - 32)
    # Reset the font.  If not called, set to Tahoma.
    $tsf_fontname = "Tahoma" if $tsf_fontname == nil
    self.contents.font.name = $tsf_fontname
    # Reset the font size.  If not called, set to 24
    $tsf_fontsize = 24 if $tsf_fontsize == nil
    self.contents.font.size = $tsf_fontsize
    @text=IO.readlines("Text/#{file}")
    @text_color=0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------  
  def refresh    
    y = 0
    for i in 0...@text.size
      y += 32
      if @text[i].index('/') == 0
        @text_color=@text[i].slice! (0..2)
        @text_color.slice!(0)
      end   
      if @text[i].index('*') == 0
        line_color=@text[i].slice! (0..2)
        line_color.slice!(0)
        self.contents.font.color = text_color(line_color.to_i)
      else
        self.contents.font.color = text_color(@text_color.to_i)
      end
      self.contents.draw_text(0, y, @sx, 32, @text[i])
    end
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------  
end



#==============================================================================
# ** Book_Scroll
#------------------------------------------------------------------------------
#  This class performs Book simulation systems.
#==============================================================================
class Book_Scroll
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize (book_name, number_of_pages, start_page, opacity_scroll, 
    opacity_bg)
    # Obtain the book name & Read the text file
    file = book_name.to_s+"/"+start_page.to_s+".rxdata"
    text=IO.readlines("Text/#{file}")
    $tss_sy= (text.size*32) + 64
    # Set the scrolling window 
    $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
    $tss_scroll_window.opacity = opacity_scroll
    $tss_scroll_window.z=500
    $tss_scroll_window.x = 0
    $tss_scroll_window.y = 0
    $tss_scroll_y_pos    = 0.0
    # Set the background window
    $tss_bg_window = Window_bg.new
    $tss_bg_window.opacity = opacity_bg
    $tss_bg_window.z=400
    # Update the displayed page
    book_update(book_name, start_page, number_of_pages, opacity_scroll, opacity_bg)
    $game_system.menu_disabled = true
  end  
  #--------------------------------------------------------------------------
  # * Update Book
  #--------------------------------------------------------------------------
  def book_update(book_name,start_page, number_of_pages, opacity_scroll,
   opacity_bg)
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # If the right directional button was pressed & not at the book's start.
      # IE:  Turning a page
      if Input.repeat?(Input::RIGHT) and number_of_pages > 1
        unless start_page == number_of_pages
          start_page+=1 
        else
          start_page=1
        end  
        # Dispose of windows
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
        # Obtain new page from book file
        Book_Scroll.new(book_name, number_of_pages,start_page, opacity_scroll, opacity_bg)
        break
      end
      # If the left directional button was pressed & not at the book's start
      # IE:  Turning a page
      if Input.repeat?(Input::LEFT) and  number_of_pages > 1
        unless start_page == 1
          start_page-=1 
        else
          start_page=number_of_pages
        end  
        # Dispose of windows
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
        # Obtain new page from book file
        Book_Scroll.new(book_name, number_of_pages,start_page, opacity_scroll, opacity_bg)
        break
      end
      # If up directional button is pushed
      if Input.repeat?(Input::UP)
        $tss_scroll_window.y+=15
      end  
      # If down directional button is pushed
      if Input.repeat?(Input::DOWN)
        $tss_scroll_window.y-=15
      end  
      # If B button was pressed
      if Input.trigger?(Input::B) 
        # Dispose of Windows
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
        # Re-enable menu
        $game_system.menu_disabled = false
        break
      end
    end
  end  
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end


#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias alex_tss_original_update update
  def update
    # Set counter to 0 (replaces the for... in Text_Scroller)
    @@i=0
    # Perform the original call
    alex_tss_original_update
    # Perform if Live Update flag is true
    if $live_scroll
      $tss_scroll_y_pos -= $tss_speed
      $tss_scroll_window.y = $tss_scroll_y-pos.to_i
      @@i += 1
      if @@i ==(($tss_sy/480.0) * $tss_iteration) + $tss_iteration
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
        @@i=0
        # Turn Live Update switch to false (turn system off)
        $live_scroll = false
      end  
    end
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end 



#==============================================================================
# ** Window_Background
#------------------------------------------------------------------------------
#  This window displays a background window for the text scrolling systems.
#==============================================================================
class Window_bg < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 480)
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end

Code:
#==============================================================================
# ** Scene_Gameover -- Now with automatic scrolling credits!
#------------------------------------------------------------------------------
#  This class performs game over screen processing.
#==============================================================================

class Scene_Gameover
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make game over graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
    # Stop BGM and BGS
    $game_system.bgm_play(nil)
    $game_system.bgs_play(nil)
    # Play game over ME
    $game_system.me_play($data_system.gameover_me)
    # Execute transition
    Graphics.transition(120)
    # Set font  and size *optional, comment out to use standard game font
    TS_Font.new('Inconsolata', 32);
    # this displays the credits... Store the file in Text in
    # your root game directory and name it Credits.rxdata
    Text_Scroller.new("Credits.rxdata", 0,0, 2, 0)
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of game over graphic
    @sprite.bitmap.dispose
    @sprite.dispose
    # Execute transition
    Graphics.transition(40)
    # Prepare for transition
    Graphics.freeze
    # If battle test
    if $BTEST
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Switch to title screen
      $scene = Scene_Title.new
    end
  end
end
 

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