#==============================================================================
# RGSS3_战斗雾景
# 原作者:tomoaky ([url]http://hikimoki.hp.infoseek.co.jp/[/url])
# 翻译、重写:Pickstar2
# 优化:可以定义一次雾飘过的数量,雾的图形种类
#==============================================================================
# ■ Sprite_Mist
#==============================================================================
module Cache
def self.battle(filename)
load_bitmap("Graphics/Battle/", filename)
end
end
module Battlefog
COLORVARIABLES = 1 # 雾图形选用文件的变量。请在Graphics中新建一个Battle文件夹
BATTLEFOG = 1 # 禁用雾图形的开关(打开为禁用)Battlefog::COLORVARIABLES
NUM = 10 # 雾的数量
end
class Sprite_Mist < Sprite
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
color = $game_variables[Battlefog::COLORVARIABLES]
if color == 1
self.bitmap = Cache.battle("mist") # 变量1的值 为1时,使用"mist"图像
elsif color == 2
self.bitmap = Cache.battle("mist")
elsif color == 3
self.bitmap = Cache.battle("mist")
elsif color == 4
self.bitmap = Cache.battle("mist")
elsif color == 5
self.bitmap = Cache.battle("mist")
elsif color == 6
self.bitmap = Cache.battle("mist")
else
self.bitmap = Cache.battle("mist") # 除此以外的情况默认使用"mist"图像
end
self.blend_type = 1
self.ox = 128
self.oy = 128
self.y = Graphics.height - 128 - self.oy + rand(180)
setup
self.x = rand(Graphics.width)
@real_x = self.x << 10
end
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
def setup
@vx = rand(512) + 512
self.zoom_x = (rand(600) + 700) / 1200.0
if self.zoom_x < 1.0 # バトラーの奥に配置
self.z = 55
else # バトラーの手前に配置
self.z = 400
end
self.zoom_y = self.zoom_x
self.x = Graphics.width + (128 * self.zoom_x).to_i
@real_x = self.x << 10
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose
super
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
@real_x -= @vx
self.x = @real_x >> 10
setup if self.x < (0 - (128 * self.zoom_x).to_i)
end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 戦闘背景(床)スプライトの作成
#--------------------------------------------------------------------------
alias tmbmist_spriteset_battle_create_battleback1 create_battleback1
def create_battleback1
tmbmist_spriteset_battle_create_battleback1
@mist_sprites = []
unless $game_switches[Battlefog::BATTLEFOG]
@mist_sprites = Array.new(Battlefog::NUM) { Sprite_Mist.new(@viewport1) }
end
end
#--------------------------------------------------------------------------
# ● 戦闘背景(床)スプライトの解放
#--------------------------------------------------------------------------
alias tmbmist_spriteset_battle_dispose_battleback1 dispose_battleback1
def dispose_battleback1
tmbmist_spriteset_battle_dispose_battleback1
@mist_sprites.each {|sprite| sprite.dispose }
end
#--------------------------------------------------------------------------
# ● 戦闘背景(床)スプライトの更新
#--------------------------------------------------------------------------
alias tmbmist_spriteset_battle_update_battleback1 update_battleback1
def update_battleback1
tmbmist_spriteset_battle_update_battleback1
@mist_sprites.each {|sprite| sprite.update }
end
end
#--------------------------------------------------------------------------
# ★
#--------------------------------------------------------------------------