전투

전투배경을 자신이 원하는 형태로

by 아방스 posted Jan 23, 2008
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
#==============================================================================
# ■ VX-RGSS2-7 Change Battle Background [Ver.1.0.0]     by Claimh
#------------------------------------------------------------------------------
# English Translation By: Elemental Crisis [http://www.rpgcrisis.net]
#------------------------------------------------------------------------------
# Changes the battle background.
#==============================================================================


module BattleBack
  #   Select Battle Background Type
  #   0:Current map with wave effect for battle background (Default VX Style).
  #   1:Current map used as battle background. 
  #   2:Uses a picture for battle background. 
  BB_TYPE = 0
  
  # Display Battle Floor
  BT_FLOOR = false

  # Picture (Only required if BB_TYPE = 2)
  M_B_BACK = {
    # Map ID => "Picture File Name(Graphics/System)"
    1 => "001-Grassland01"
  }
end


#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● Creating Battle Back Sprite
  #--------------------------------------------------------------------------
  def create_battleback
    case BattleBack::BB_TYPE
    when 0
      source = $game_temp.background_bitmap
      bitmap = Bitmap.new(640, 480)
      bitmap.stretch_blt(bitmap.rect, source, source.rect)
      bitmap.radial_blur(90, 12)
      @battleback_sprite = Sprite.new(@viewport1)
      @battleback_sprite.bitmap = bitmap
      @battleback_sprite.ox = 320
      @battleback_sprite.oy = 240
      @battleback_sprite.x = 272
      @battleback_sprite.y = 176
      @battleback_sprite.wave_amp = 8
      @battleback_sprite.wave_length = 240
      @battleback_sprite.wave_speed = 120
    when 1
      source = $game_temp.background_bitmap
      bitmap = Bitmap.new(640, 480)
      bitmap.stretch_blt(bitmap.rect, source, source.rect)
      @battleback_sprite = Sprite.new(@viewport1)
      @battleback_sprite.bitmap = bitmap
      @battleback_sprite.ox = 320
      @battleback_sprite.oy = 240
      @battleback_sprite.x = 272
      @battleback_sprite.y = 176
    when 2
      @battleback_sprite = BattleBackSprite.new(@viewport1)
    end
  end
  #--------------------------------------------------------------------------
  # ● Creating Battle Floor Sprite
  #--------------------------------------------------------------------------
  alias create_battlefloor_mbb create_battlefloor
  def create_battlefloor
    create_battlefloor_mbb if BattleBack::BT_FLOOR
  end
  #--------------------------------------------------------------------------
  # ● Delete Battle Floor Sprite
  #--------------------------------------------------------------------------
  alias dispose_battlefloor_mbb dispose_battlefloor
  def dispose_battlefloor
    dispose_battlefloor_mbb if BattleBack::BT_FLOOR
  end
  #--------------------------------------------------------------------------
  # ● Update Battle Floor Sprite
  #--------------------------------------------------------------------------
  alias update_battlefloor_mbb update_battlefloor
  def update_battlefloor
    update_battlefloor_mbb if BattleBack::BT_FLOOR
  end
end


#==============================================================================
# ■ BattleBackSprite
#==============================================================================
class BattleBackSprite < Sprite
  # Background Screen Size
  WIDTH  = 544.00
  HEIGHT = 288.00
  #--------------------------------------------------------------------------
  # ● Object Initialization
  #     viewport : viewport
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    super(viewport)
    self.bitmap = Cache.system(BattleBack::M_B_BACK[$game_map.map_id])
    # Zoom is carried out according to picture size.
    @x_zoom = WIDTH / self.bitmap.width
    @y_zoom = HEIGHT / self.bitmap.height
    @zoom = @x_zoom > @y_zoom ? @x_zoom : @y_zoom
    # Zoom is carried out.
    self.zoom_x = @zoom
    self.zoom_y = @zoom
    # Made into central display.
    self.ox = self.bitmap.width / 2
    self.oy = self.bitmap.height / 2
    self.x = (self.bitmap.width / 2)  * @zoom
    self.y = (self.bitmap.height / 2) * @zoom
  end
end