随便扒了个站上的脚本..给你改了改
#============================================================================== # ■ VX-RGSS2 改变战斗背景 [版本.1.0.0] by Claimh 修改:铅笔描绘的思念 #------------------------------------------------------------------------------ # 改变战斗的背景图. #============================================================================== module BattleBack # 使用的图片 M_B_BACK = [ "001-Fog01", "测试" ]# "(Graphics/Battleback/图片名)" end module Cache def self.battleback(filename) load_bitmap("Graphics/Battleback/", filename) end end class Spriteset_Battle def create_battleback @battleback_sprite = BattleBackSprite.new(@viewport1) end end #============================================================================== # ■ BattleBackSprite #============================================================================== class BattleBackSprite < Sprite # Background Screen Size WIDTH = 544.00 HEIGHT = 416.00 #-------------------------------------------------------------------------- # ● Object Initialization # viewport : viewport #-------------------------------------------------------------------------- def initialize(viewport = nil) super(viewport) random = rand(BattleBack::M_B_BACK.size) self.bitmap = Cache.battleback(BattleBack::M_B_BACK[random]) # 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
#==============================================================================
# ■ VX-RGSS2 改变战斗背景 [版本.1.0.0] by Claimh 修改:铅笔描绘的思念
#------------------------------------------------------------------------------
# 改变战斗的背景图.
#==============================================================================
module BattleBack
# 使用的图片
M_B_BACK = [ "001-Fog01", "测试" ]# "(Graphics/Battleback/图片名)"
end
module Cache
def self.battleback(filename)
load_bitmap("Graphics/Battleback/", filename)
end
end
class Spriteset_Battle
def create_battleback
@battleback_sprite = BattleBackSprite.new(@viewport1)
end
end
#==============================================================================
# ■ BattleBackSprite
#==============================================================================
class BattleBackSprite < Sprite
# Background Screen Size
WIDTH = 544.00
HEIGHT = 416.00
#--------------------------------------------------------------------------
# ● Object Initialization
# viewport : viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
random = rand(BattleBack::M_B_BACK.size)
self.bitmap = Cache.battleback(BattleBack::M_B_BACK[random])
# 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
|