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] BDR : framework for BDR packages


BDR : framework for BDR packages
by Fustel
version 1.0



Introduction
  As I consider writing more than 1 script for RMVX, I first startde with this little framework, whick shall be a requirement for all my future 'package'
  I did it to have maximum encapsulation of all my work, providing as much compatiblity as possible, and as little repetitive work to do (variable initailization, saving, and loading)

Features
  Introduce the TBDR class, which shall be overloaded by the various BDR package
  Each package shall introduce one or more properties which will manage the package features

Installation
  Just copy the script in the Materials section, ABOVE any BDR package

Initialization
  n/a

Usage
  n/a

Script
Code:
#==========================================================================================================================
# ** BDR : Framework for BDR packages
#------------------------------------------------------------------------------
#  © Fustel, 2008
#  12/10/08
#  Version 1.0
#------------------------------------------------------------------------------
# VERSION HISTORY
#   12/10/08 : v1.0 : original release
#--------------------------------------------------------------------------------------------------------------------------
# INSTALLATION
#   Copy this script in the Material section, ABOVE any BDR package
#--------------------------------------------------------------------------------------------------------------------------
#  CONFIGURATION
#    n/a
#--------------------------------------------------------------------------------------------------------------------------
# USAGE
#   n/a
#--------------------------------------------------------------------------------------------------------------------------
# FEATURES
#   This script is required for all (soon to come) BDR packages
#   It feature instanciation, saving, and loading of the $BDR variable
#   The TBDR class will be overloaded by the various pachages, each package introcuding a new property
#     to manage the package features
#==========================================================================================================================


# the Garbage Collector seems not to be started by default
# may help to start it, due to all the junk generated by BDR ;-)
#------------------------------------------------------------------------------
GC.start

# initial declaration of the TBDR class
# this class will be overloaded with packages
# its instance is $BDR
#------------------------------------------------------------------------------
class TBDR
end

# Overwriting of the Scene_Title class for creation of the $BDR variable
#------------------------------------------------------------------------------
class Scene_Title < Scene_Base
  alias bdr_create_game_objects create_game_objects

  def create_game_objects
    bdr_create_game_objects
    $BDR = TBDR.new
  end
end

# overwriting of the Scene_File class for saving/loading of the $BDR variable
#------------------------------------------------------------------------------
class Scene_File < Scene_Base
  alias bdr_write_save_data write_save_data
  alias bdr_read_save_data read_save_data

  def write_save_data( file)
    bdr_write_save_data( file)
    Marshal.dump( $BDR, file)
  end

  def read_save_data( file)
    bdr_read_save_data( file)
    $BDR = Marshal.load( file)
  end
end

Demo
  n/a

Screenshot
  n/a
 

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