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 Darkness : package for Darkness and Lights


BDR Darkness : package for Darkness and Lights
by Fustel
version 1.0



Introduction
  This BDR package is written to manage farkness and lights.

Features
  Darkness is a Sprites covering the whole screen. It is full white, and drawn with a 2 (sunstract) blending mode.
  Darkness opacity may be set and is memorized for each map.
  A default Darkness opacity is defined. It is used the first time a map is entered, if not already set for this map.
  Lights are black 'holes' redrawn each frame in the Darkness Sprite via the stretch_blt method of its Bitmap.
  The size and pattern of these 'holes' are determined in Models to which each light is linked.
  Lights may be attached to fixed position, the character, or an Event on the map.
  They are also assigned to a specific map, or to all maps (like the lights assigned to the character)
  Lights may also be given a duration (like the burning of a torch), as defined in the model. This duration is reduced at each step taken, and is destroyed when the duration exprires
  Lights may also be set to burn forever.
  You can suspend and resume time, so that the light duration is not consumed
  Each lights is assigned to a group.
  The lights may be suspended (not shown but still existing), resume, or destroyed all at a time, by group, or by bind object (fixed, char, event)

Limitations
  Due to the redraw of each visible light at each frame, a practical maximum of between
    1000 total lights with 100 lights per map, and 2000 total lighs with 50 lights per map
    is recommended.
  For the time being, and due to limitation of the stretch_blt method, only pre black masks are recommanded for light Model Pictures (play with other patterns in the 'Room of the Mixed Lights' in the dem, and you'll know...). A workaround using en external DLL is beeing studied.
  The Darkness opacity transition is a litle blunt, but this will be corrected soon.

  And for those who ask : why holes in a big '-' blend Sprite instead of some '+' Sprites on an allready darkended scene (like with Kylock's 'Light Effects').
  Answer : This is to keep th original contrast.  The darkeninf of a map 'crushes" the contrast, and adding little light sprites only lightens the spot, bot do not restore the contrast. A light not do have to lighten the spot, but also enable you to see what is there...

Requirement
  This package requires the following to be installed in your project
  - BDR : Frame for BDR packages

  Also, do not forget the Pictuures in your Graphics\Pictures directory. They can be found there
    http://www.mediafire.com/download.php?zadzkntydzt

Installation
  Just copy the engine script below the BDR module, and above the Main module, in the Material section
  You also have to have some light patterns in the Graphics\Pictures directory, like the ones foud here :
    http://www.mediafire.com/download.php?zadzkntydzt
  Then, you may write a configuration module below it.

Initialization
  Like every BDR package, the configuration is done by adding a module below the package, overwriting an
    init_<package name> method, using internal methods.
  This module must look like :

Code:
  class TBDR
    def init_darkness
      ....
      <calls to initializing methods>
      ....
     end
   end

  The initializing method are
    - to set the default opacity (default setting = 255 : pitch black)
        darkness.default_opacity = <value>
          <value> : default opacity
    - to set a given map opacity
        darkness.set_map_opacity( map_id, value)
          map_id : the numerical ID of the map
          opacity : the opacity for this map
    - to add a light Model
        darkness.add_light_model( name, bmp_name[, radius[, d_min[, d_delta]]])
          name : model name
          bmp_name : Picture file name
          radius ( default = 1) : light radius (in tile)
          d_min ( default = -1) : the base duration of the light (<0 : eternal)
          d_delta ( default = 20) : a number between 0 and this value is added to the base duration
    - to start a light
        darkness.start_light( model, bind[, map[, group[, x[, y]]]])
          model : model name
          bind : bind objext (<0 : fixed, 0 : character, >0 : event ID)
          map ( default = nil) : map_ID (if not provided : 0 if bound to character, current map otherwise)
          group ( default = 0) : group
          x ( default = -1) : x position in map tile for fixed light
          y ( default = -1) : y position in map tile for fixed light

Usage
   You can use the previous methods in any script, prefixing them with '$BDR.'
     (i.e. : $BDR.darkness.start_light)
   You can also use the following method in initialization, but without the '$BDR.'
     (i.e. : darkness.suspend_light)

    - to suspend lights in the whole project
        $BDR.darkness.suspend_light([ group[, bind]])
          group ( default = nil) : group to be suspended
          bind ( default = nil) : the binding object
            nb : lights are suspended in all maps
            nb : if no parameter is provided, all lights a suspended
            nb : the light corresponding to the group OR the binfing object are suspended
    - to resum suspended lights in the whole project
        $BDR.darkness.resume_light([ group[, bind]])
          group ( default = nil) : group to be resumed
          bind ( default = nil) : the binding object
            nb : lights are resumed in all maps
            nb : if no parameter is provided, all lights are resumed
            nb : the light corresponding to the group OR the binfing object are resumed
    - to stop lights in the current map (these lights are removed from the map)
        $BDR.darkness.stop_light([ group[, bind]])
          group ( default = nil) : group to be resumed
          bind ( default = nil) : the binding object
            nb : lights are stopped in the current map
            nb : if no parameter is provided, all lights are stopped
            nb : a stopped light may NOT be resumed
            nb : the light corresponding to the group OR the binfing object are resumed
            nb : lights assigned to all maps (map_is <= 0) may not be stopped
    - to suspend consumption of all lights
        $BDR.darkness.suspend_time
    - to resume consumption of all lights
        $BDR.darkness.resume_time


Script
Code:
# REQUIREMENTS
#   This package requires the following to be installed in your project
#   - BDR : Frame for BDR packages
#
#--------------------------------------------------------------------------------------------------------------------------
# INSTALLATION
#   Just copy the engine script below the BDR module, and above the Main module, in the Material section
#   You also have to have some light patterns in the Graphics\Pictures directory
#   Then, you may write a configuration module below it.
#
#--------------------------------------------------------------------------------------------------------------------------
# CONFIGURATION
#   Like every BDR package, the configuration is done by adding a module below the package, overwriting an
#     init_<package name> method, using internal methods.
#   This module must look like :
#
#  [code]
#   class TBDR
#     def init_darkness
#       ....
#       <calls to initializing methods>
#       ....
#      end
#    end
# 
#
#  The initializing method are
#    - to set the default opacity (default setting = 255 : pitch black)
#        darkness.default_opacity = <value>
#          <value> : default opacity
#    - to set a given map opacity
#        darkness.set_map_opacity( map_id, value)
#          map_id : the numerical ID of the map
#          opacity : the opacity for this map
#    - to add a light Model
#        darkness.add_light_model( name, bmp_name[, radius[, d_min[, d_delta]]])
#          name : model name
#          bmp_name : Picture file name
#          radius ( default = 1) : light radius (in tile)
#          d_min ( default = -1) : the base duration of the light (<0 : eternal)
#          d_delta ( default = 20) : a number between 0 and this value is added to the base duration
#    - to start a light
#        darkness.start_light( model, bind[, map[, group[, x[, y]]]])
#          model : model name
#          bind : bind objext (<0 : fixed, 0 : character, >0 : event ID)
#          map ( default = nil) : map_ID (if not provided : 0 if bound to character, current map otherwise)
#          group ( default = 0) : group
#          x ( default = -1) : x position in map tile for fixed light
#          y ( default = -1) : y position in map tile for fixed light
#
#--------------------------------------------------------------------------------------------------------------------------
# USAGE
#   You can use the previous methods in any script, prefixing them with '$BDR.'
#     (i.e. : $BDR.darkness.start_light)
#   You can also use the following method in initialization, but without the '$BDR.'
#     (i.e. : darkness.suspend_light)
#
#    - to suspend lights in the whole project
#        $BDR.darkness.suspend_light([ group[, bind]])
#          group ( default = nil) : group to be suspended
#          bind ( default = nil) : the binding object
#            nb : lights are suspended in all maps
#            nb : if no parameter is provided, all lights a suspended
#            nb : the light corresponding to the group OR the binfing object are suspended
#    - to resum suspended lights in the whole project
#        $BDR.darkness.resume_light([ group[, bind]])
#          group ( default = nil) : group to be resumed
#          bind ( default = nil) : the binding object
#            nb : lights are resumed in all maps
#            nb : if no parameter is provided, all lights are resumed
#            nb : the light corresponding to the group OR the binfing object are resumed
#    - to stop lights in the current map (these lights are removed from the map)
#        $BDR.darkness.stop_light([ group[, bind]])
#          group ( default = nil) : group to be resumed
#          bind ( default = nil) : the binding object
#            nb : lights are stopped in the current map
#            nb : if no parameter is provided, all lights are stopped
#            nb : a stopped light may NOT be resumed
#            nb : the light corresponding to the group OR the binfing object are resumed
#            nb : lights assigned to all maps (map_is <= 0) may not be stopped
#    - to suspend consumption of all lights
#        $BDR.darkness.suspend_time
#    - to resume consumption of all lights
#        $BDR.darkness.resume_time
#--------------------------------------------------------------------------------------------------------------------------
# FEATURES
#   Darkness is a Sprites covering the whole screen. It is full white, and drawn with a 2 (sunstract) blending mode.
#   Darkness opacity may be set and is memorized for each map.
#   A default Darkness opacity is defined. It is used the first time a map is entered, if not already set for this map.
#   Lights are black 'holes' redrawn each frame in the Darkness Sprite via the stretch_blt method of its Bitmap.
#   The size and pattern of these 'holes' are determined in Models to which each light is linked.
#   Lights may be attached to fixed position, the character, or an Event on the map.
#   They are also assigned to a specific map, or to all maps (like the lights assigned to the character)
#   Lights may also be given a duration (like the burning of a torch), as defined in the model. This duration is reduced
#     at each step taken, and is destroyed when the duration exprires
#   Lights may also be set to burn forever.
#   You can suspend and resume time, so that the light duration is not consumed
#   Each lights is assigned to a group.
#   The lights may be suspended (not shown but still existing), resume, or destroyed all at a time, by group,
#     or by bind object (fixed, char, event)
#
#--------------------------------------------------------------------------------------------------------------------------
# LIMITATION
#   Due to the redraw of each visible light at each frame, a practical maximum of between
#     1000 total lights with 100 lights per map, and 2000 total lighs with 50 lights per map
#     is recommended.
#   For the time being, and due to limitation of the stretch_blt method, only pre black masks are recommanded for
#     light Model Pictures (play with other patterns in the 'Room of the Mixed Lights' in the dem, and you'll know...)
#     A workaround using en external DLL is beeing studied.
#   The Darkness opacity transition is a litle blunt, but this will be corrected soon.
#
#   And for those who ask : why holes in a big '-' blend Sprite instead of some '+' Sprites on an allready darkended scene
#     (like with Kylock's 'Light Effects').
#     Answer : This is to keep th original contrast.  The darkeninf of a map 'crushes" the contrast, and adding little
#        light sprites only lightens the spot, bot do not restore the contrast. A light not do have to lighten the spot,
#        but alos enable you to see what is there...
#--------------------------------------------------------------------------------------------------------------------------



# TBDRDarknessSprite : The Sprite that displays darkness and lights
#   it is instanced as @bdr_darkness_sprite in the SpriteSet_Map class
#===============================================================================

class TBDRDarknessSprite < Sprite

  # initialization : create the internal Bitmap
  #   bdr_darkness : the BDR darkness package variable
  #   viewport : viewport to display the Sprite
  #-------------------------------------------------------------
  def initialize( bdr_darkness, viewport=nil)
    super( viewport)
    @bdr_darkness = bdr_darkness    # the BDR variable that contains all darkness and lights parameters

    self.bitmap = Bitmap.new( 544, 416)
    self.x = 0
    self.y = 0
    self.z = 90
    self.ox = 0
    self.oy = 0
    self.zoom_x = 1.0
    self.zoom_y = 1.0
    self.blend_type = 2
    self.opacity = 0

    update
  end

  # dispose : release the internal Bitmap
  #--------------------------------------------------------
  def dispose
    self.bitmap.dispose
    super
  end

  # update : fill the Bitmpa with darkness and copy the revelant lights
  #----------------------------------------------------------------------------
  def update
    self.visible = ( @bdr_darkness.opacity > 0)

    if self.visible
      self.opacity = @bdr_darkness.opacity
      self.bitmap.fill_rect( self.bitmap.rect, Color.new( 255, 255, 255))
      for light in @bdr_darkness.lights
        if ( ( light.map_id <= 0) or ( light.map_id == $game_map.map_id)) and ( not light.suspended)
          s = ( 32 * light.model.radius + 16).to_i
          r = Rect.new( light.x-s, light.y-s, s*2, s*2)
          self.bitmap.stretch_blt( r, light.model.bmp, light.model.bmp.rect, 255)
        end
      end
    end

    super
  end
end

# TBDR : overwritten to introduce the dakness package
# Internal classes are
#   TDarknessLightModel : the model used for the lights (shape, radios, duration)
#   TDarknessLight :  the actual lights ( kind of instances of Models) displayed
#   TDarkness : the package class
#--------------------------------------------------------------------------------
class TBDR

  # TDarknessLightModel : defines the various types of lights usable in the darkness pacakage
  # This class is instanciated via the TDarkness::add_model method
  #
  # Properties
  #   name (R) : the name identifiing the Model
  #   bmp_name (R) : the name of the Picture file containing the pattern of the Model
  #   raduis (R) : the radius of the Model, in tiles.
  #   duration_min (R) : the minimum duration, in steps taken, of the light.
  #                      a negative value means a eternal light
  #   duration_delta (R) : a value between 0 and this parameter is addes to the base duration
  #                          when the light is started
  #   bmp (R) : the actual Bitmap of the light, loaded from bmp_name
  #===============================================================================================
  class TDarknessLightModel
    attr_reader :name
    attr_reader :bmp_name
    attr_reader :radius
    attr_reader :duration_min
    attr_reader :duration_delta

    # initialization
    #   name : ID of the Model
    #   bmp_name : name of the picture file (in Graphics\Pictures)
    #   rad (def = 1) : radius in tiles
    #   d_min (def = -1: eternal) : the base duration
    #   d_delta (def = 20) : the variation of duration
    #-----------------------------------------------------------
    def initialize( name, bmp_name, rad=1, d_min=-1, d_delta=20)
      @name = name                 # name of the model
      @bmp_name = bmp_name         # name of the picture file
      @radius = rad                # in tiles around the character
      @duration_min = d_min        # < 0: infinite / > 0: number of steps otherwise
      @duration_delta = d_delta    # in number of steps
    end

    # Reader for the Bitmap
    #--------------------------
    def bmp
      Cache.picture( @bmp_name)
    end
  end

  # TDarknessLight : represents each light displayed in-game
  # This class is instanciated via the TDarkness::start_light method
  #
  # Properties
  #   model (R) :  a pointer to the Model of this light
  #   map_id (R) : the map ID on which this light is displayed
  #                a 0 of negative ID means it is displayed on every map (personnal light)
  #   bind_obj (R) : to type of object to which the light is bound
  #                  <0 : a fixed position
  #                   0 : the player character
  #                  >0 : an event whose ID is the bind_obj value
  #   group (R) : a group ID to which this light is attaced
  #   suspended (R) : wheter the light is suspended or not (a suspended light is not shown but still exists)
  #   duration (R) : number of steps remaining before the light goes off
  #   x (R) : the display x coordinate (in screen pixel)
  #   y (R) : the display y coordinate (in screen pixel)
  #
  # Methods
  #   increse_steps : reduced the duration of the non-eternal, non-suspended light; calld by TDarkness::increase_steps
  #===================================================================================================================
  class TDarknessLight
    attr_reader :model
    attr_reader :map_id
    attr_reader :bind_obj
    attr_reader :group
    attr_accessor :suspended
    attr_reader :duration

    # Initialization
    #   model : pointer to the light model
    #   map: map ID
    #   bind (def = 0) : binding object
    #   grp (def = 0) : group of the light
    #   x (def = -1) : x position (in map tile) for a fixed light
    #   y (def = -1) : y position (in map tile) for a fixed light
    #--------------------------------------------------------------------
    def initialize( model, map, bind=0, grp=0, x=-1, y=-1)
      @model = model
      @map_id = map                # <= 0: every map, >0 : id of map
      @bind_obj = bind             # < 0: fixed (x,y=map coordinates),0: player (x,y meaningless), > 0: event ID (x,y meaningless)
      @group = grp
      @x = x
      @y = y
      @duration = 1                # steps remaining
      @suspended = false
      @duration = @model.duration_min + rand( @model.duration_delta) if @model.duration_min >= 0
    end

    # returns the x position (in screen pixel)
    #----------------------------------------------
    def x
      return @x*32 - $game_map.display_x/8 +16 if @bind_obj < 0
      return ( $game_player.real_x - $game_map.display_x) / 8 + 16 if @bind_obj == 0
      return ( $game_map.events[ @bind_obj].real_x - $game_map.display_x) / 8 + 16 if @bind_obj > 0 and $game_map.events[ @bind_obj].is_a?( Game_Event)
      return @x
    end

    # returns the y position (in screen pixel)
    #----------------------------------------------
    def y
      return @y*32 - $game_map.display_y/8 +16 if @bind_obj < 0
      return ( $game_player.real_y - $game_map.display_y) / 8 + 16 if @bind_obj == 0
      return ( $game_map.events[ @bind_obj].real_y - $game_map.display_y) / 8 + 16 if @bind_obj > 0 and $game_map.events[ @bind_obj].is_a?( Game_Event)
      return @y
    end

    # decrease the duration of the light for each step taken
    #--------------------------------------------------------
    def increase_steps
      @duration -= 1 if ( @model.duration_min >= 0)  and not @suspended
    end
  end

  # TDarkness : the pachage class
  # Its instance is $BDR.darkness
  # The instance is used do manage Darkness and Lights via its methods
  #
  # Properties
  #   default_opacity (R/W) : the default opacity of Darkness the first time a map is entered, if not already set
  #   opacity (R/W) : the darkness opacity of the current map
  #   time_suspended (R/W) : if the time is suspended, no light duration is reduced
  #   lights (R) : the lights list
  #
  # Methods
  #   update : perform timed updates - called by $game_map.update
  #   set_map_opacity : set the opacity of a given map
  #     map_id : the ID of the map
  #     opacity : the opacity of the map
  #   suspend_time : set the time_suspended flag to true
  #   resume_time : set the time_suspended flag to false
  #   add_light_model : create a new light model
  #     name : model name
  #     bmp_name : Picture file name
  #     rad (def = 1) : light radius (in tile)
  #     d_min (def = -1) : the base duration of the light (<0 : eternal)
  #     d_delta (def = 20) : maximum variation to the base duration
  #   start_light : start a new light
  #     model : model ID (not pointer)
  #     bind : bind objext (<0 : fixed, 0 : character, >0 : event ID)
  #     map (def = nil) : map_ID (if not provided, 0 if bound to character, current map otherwise)
  #     grp (def = 0) : group
  #     x (def = -1) : x position (in map tile) for fixed light
  #     y (def = -1) : y position (in map tile) for fixed light
  #   resume_light : resume all light on every maps if no parameters provided
  #     grp (def = nil) : limits the resume to a single group
  #     obj (def = nil) : limits the resume to a bind object/light type
  #   suspend_light : suspend all light on every maps if no parameters provided
  #                   suspended lights may be resumed
  #     grp (def = nil) : limits the suspend to a single group
  #     obj (def = nil) : limits the suspend to a bind object/light type
  #   stop_light : stop and remove all light on the current map map from the list if no parameters provided
  #                stopped lights may NOT be resumed
  #                note tha a 0-map eternal light may not be stopped
  #     grp (def = nil) : limits the stop to a single group
  #     obj (def = nil) : limits the stop to a bind object/light type
  #   enter_map : perform various initializations for the current map
  #               called by $game_map.setup
  #     map_id : the map ID
  #   increase_steps : calls increase_steps method for all lights in the list, stops the burned-out ones
  #                    called by $game_party.increase_steps
  #=====================================================================================================
  class TDarkness
    attr_reader :default_opacity
    attr_reader :time_suspended
    attr_reader :lights

    # initialization
    #---------------------------------------
    def initialize
      @default_opacity = 0
      @opacity = []
      @time_suspende = false
      @models = {}
      @lights = []
    end

    # opdate
    # placeholde, does nothing for now
    #   planned : darkness falling gradually
    #------------------------------------------------
    def update
    end

    # Writer for @default_opacity
    #--------------------------------------
    def default_opacity=( val)
      @default_opacity = [[ val, 0].max, 255].min if val.is_a?( Integer)
    end

    # reader for @opacity
    #---------------------------------------
    def opacity
      return @default_opacity if @opacity[ $game_map.map_id] == nil
      return @opacity[ $game_map.map_id]
    end

    # writer for @opacity
    #---------------------------------------
    def opacity=( val)
      @opacity[ $game_map.map_id] = val
    end

    # set a map opacity
    #   map : map ID
    #   opacity : opacity
    #-------------------------------------------------
    def set_map_opacity( map, opac)
      @opacity[ map] = opac
    end

    # writer for @time_suspended (true)
    #-----------------------------------------------
    def suspend_time
      @time_suspended = true
    end

    # writer for @time_suspended (false)
    #-----------------------------------------------
    def resume_time
      @time_suspended = false
    end

    # create a new light model
    #   name : model ID
    #   bmp_name : Picture file name
    #   rad : radius in tile
    #   d_min : minimum duration (<0 : eternalà
    #   d_delta : variation to the minimum duration
    #--------------------------------------------------------------------------------------------
    def add_light_model( name, bmp_name, rad=1, d_min=-1, d_delta=20)
      @models[ name.to_s] = TDarknessLightModel.new( name, bmp_name, rad, d_min, d_delta)
    end

    # create a new light
    #   model : model ID
    #   bind : bind object ( <0 : fixed, 0 : character, >0 : ecent ID)
    #   map : map ID ( <= 0 : everywhere)
    #   grp : group
    #   x : x position for a fixed light in map tile
    #   y : y position for a fixed light in map tile
    #---------------------------------------------------------------------------
    def start_light( model, bind, map=nil, grp=0, x=-1, y=-1)
      map = 0 if ( map == nil) and ( bind == 0)
      map = $game_map if map == nil
      @lights.push( TDarknessLight.new( @models[ model], map, bind, grp, x, y))
      @lights.sort!{|a,b| a.model.radius <=> b.model.radius}
    end

    # resumes lights in all maps
    #   grp : group
    #   obj : bind object
    #--------------------------------------------------------
    def resume_light( grp=nil, obj=nil)
      update_suspended( false, grp, obj)
    end

    # performs the suspend/resume
    #--------------------------------------------------
    def update_suspended( susp, grp, obj)
      for light in @lights do
        light.suspended = susp if light.group == grp
        light.suspended = susp if light.bind_obj == obj
        light.suspended = susp if (grp == nil) and ( obj == nil)
      end
    end

    # suspends lights in all maps
    #   grp : group
    #   obj : bind object
    #--------------------------------------------------------
    def suspend_light( grp=nil, obj=nil)
      update_suspended( true, grp, obj)
    end

    # remove lights from the current map from the list
    #   grp : group
    #   obj : bind object
    #--------------------------------------------------------
    def stop_light( grp=nil, obj=nil)
      for light in @lights do
        if light.map_id == $game_map.map_id  # only current map
          @lights[ @lights.index( light)] = nil if light.group == grp
          @lights[ @lights.index( light)] = nil if light.bind_obj == obj
          @lights[ @lights.index( light)] = nil if ( grp == nil) and ( obj == nil)
        end
      end
      @lights.compact!
    end

    # setup on entering map
    # - sets the map opacity to @default_opacity if not already done
    #---------------------------------------------------------------------
    def enter_map( map)
      @opacity[ map] = @default_opacity if @opacity[ map] == nil
    end

    # performs the consumption of all lights
    #-----------------------------------------------------
    def increase_steps
      if not @time_suspended
        for light in @lights do
          light.increase_steps
          @lights[ @lights.index( light)] = nil if light.duration <= 0
        end
        @lights.compact!
      end
    end
  end

  # package initialization
  #=================================

  attr_reader :darkness

  alias darkness_initialize initialize

  def initialize
    darkness_initialize
    @darkness = TDarkness.new
    init_darkness
  end

  def init_darkness
  end
end

# overriding of the Game_Map class
# - setup for TDarkness::enter_map
# - update for TDarkness::update
#============================================
class Game_Map
  alias bdr_darkness_setup setup
  alias bdr_darkness_update update

  def setup(map_id)
    bdr_darkness_setup(map_id)
    $BDR.darkness.enter_map( map_id)
  end

  def update
    bdr_darkness_update
    $BDR.darkness.update
  end
end

# overriding of the Game_party class
# - increase_steps for TDarkness::increase_steps
#========================================================
class Game_Party < Game_Unit
  alias bdr_darkness_increase_steps increase_steps

  def increase_steps
    bdr_darkness_increase_steps
    $BDR.darkness.increase_steps
  end
end

# overriding of the SpriteSet_Map class
# - initialize for the creation of @bdr_darkness_sprite Sprite, instance of the TBDRDarknessSprite class
# - dispose for the disposal of @bdr_darkness_sprite
# - update for the update of @bdr_darkness_sprite
#=======================================================================================================
class Spriteset_Map
  attr_reader :bdr_darkness_sprite

  alias bdr_darkness_initialize initialize
  alias bdr_darkness_dispose dispose
  alias bdr_darkness_update update

  def initialize
    @bdr_darkness_sprite = TBDRDarknessSprite.new( $BDR.darkness)
    bdr_darkness_initialize
  end

  def dispose
    bdr_darkness_dispose
    @bdr_darkness_sprite.dispose
  end

  def update
    bdr_darkness_update
    @bdr_darkness_sprite.update
  end
end
[/code]

Demo
download it there :
http://www.mediafire.com/download.php?avyxmjnzmzg

Screenshot
still don't know how to include an image... scrogneugneu!!!
 

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