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.

VRE - Scene Template Sample

OS

Sponsor

I have decided that I have all I need for now. I'd like to know what you all think of the current look of a Generated Scene. This example shows a Scene called MyClass, and shows many of the Options available (Updating, Player Input, etc.) Everything is commented, and to show how Command Windows are dealt with, I threw in a sample Window_Command object.

*NOTE: This code is not ready-to-run in RGSS. It is merely an example of what the generated code will look like.

So, tell me what you think!

Code:
#===============================================================================
# Scene_<Name>
# By <Author>
# Version: <Version>
# Date: <DateTime.Now> ##<- the exact moment of Generation
#===============================================================================
# Instructions:
# <User Defined, post-Generation>
## I may (and I stress the word 'MAY') be able to generate instructions as well
## by looking at the menus and options used by the User. These instructions
## would be partial in some cases, because the entire script isn't always made
## by the generator.
#===============================================================================
class Scene_MyClass
  #=============================================================================
  # Attribute Accessors
  #=============================================================================
  
  #=============================================================================
  # Aliases
  #=============================================================================
  
  #=============================================================================
  # Initialize
  # parameters - none
  #=============================================================================
  def initialize
  end
  #=============================================================================
  # Main
  #=============================================================================
  def main
    ## Replace (Map) with Sprite if SpriteAsBack instead of MapAsBack
    ## Replace (Map) with Sprites if AnimatedBack instead of MapAsBack
    # Create the (Map) for the Background
    @back_sprite = Spriteset_Map.new
    # Create all windows
    create_windows
    # Create all sprites
    create_sprites
    # Transition from previous scene
    Graphics.transition(20, "Graphics/Transitions/001-Blind01")
    # Begin loop
    loop do
      # Update Graphics
      Graphics.update
      # Update Input
      Input.update
      # Update self
      update
      # If this is not the current scene,
      if $scene != self
        # break the loop
        break
      end
    end
    # Freeze the graphics for the transition in the next scene
    Graphics.freeze
    # Dispose of the Windows
    dispose_windows
    # Dispose of the Sprites
    dispose_sprites
  end
  #=============================================================================
  # Create Windows
  #=============================================================================
  def create_windows
    # Create Command Window1
    @command_window1 = Window_Command.new(120, ["Test 0", "Test 1", "Test 2"])
  end
  #=============================================================================
  # Create Sprites
  #=============================================================================
  def create_sprites
  end
  #=============================================================================
  # Update Windows
  #=============================================================================
  def update_windows
    # Update Command Window1
    @command_window1.update
  end
  #=============================================================================
  # Update Sprites
  #=============================================================================
  def update_sprites
  end
  #=============================================================================
  # Dispose Windows
  #=============================================================================
  def dispose_windows
    # Dispose Command Window1
    @command_window1.dispose
  end
  #=============================================================================
  # Dispose Sprites
  #=============================================================================
  def dispose_sprites
  end
  #=============================================================================
  # Update
  #=============================================================================
  def update
    # Update Background (if needed)
    @back_sprite.update
    # Update Windows
    update_windows
    # Update Sprites
    update_sprites
    ## At this point, create a series of update_window_name methods for each
    ## Window_Command in the scene, in order from FirstFrame to LastFrame.
    ## Always check if active, and make windows Opacity change as described in
    ## their individual properties. Like so:
    if @command_window1.active
      update_command_window1
      # Return to the Calling Method
      return
    end
  end
  #=============================================================================
  # Update Command Window1
  #=============================================================================
  def update_command_window1
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      ## Here goes code to either go back a menu if this menu is not the first,
      ## or go back to the previous scene.
      # Return to the Calling Method
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window1.index
      when 0  # item_label_0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        ## Get Action Data from Window Properties
      when 1  # item_label_1
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        ## Get Action Data from Window Properties
      when 2  # item_label_2
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        ## Get Action Data from Window Properties
      end
      # Return to the Calling Method
      return
    end
  end
end

Peace!

~Optimist Shadow
 

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