#============================================================================== # ★ RainbowFlash ver1.0 by USK 2014 1/3 #------------------------------------------------------------------------------ # ・歩行グラフィック、ピクチャ、バトラーにブログgifのようなエフェクトを追加し # ます。 #============================================================================== =begin ・歩行グラフィック イベントコマンドの移動ルートの設定にて、 start_rainbow(0〜119の数字) と記入すると対象が虹色に変色します。()のなかの数字は変色開始時のいろと関係して いて、同じ番号は同じ色から始まります。 終了するときは end_rainbow と記入してください ・ピクチャ イベントコマンド、バトルイベントで start_rainbow(ピクチャ番号,0〜119の数字) と記入するとピクチャ番号と同じ番号のピクチャが虹色に変色します。 0〜119の数字は変色開始時のいろと関係していて、同じ番号は同じ色から始まります。 終了するときは end_rainbow(ピクチャ番号) と記入するとピクチャ番号と同じ番号のピクチャの色が元に戻ります。 ・バトラー バトルイベントで start_rainbow_b(対象の敵グループ内の番号,0〜119の数字) と記入すると同じ番号のバトラーが虹色に変色します。敵グループ内の番号とは イベントコマンドの「敵キャラのHPの増減」等で指定するときの番号のことです。 0〜119の数字は変色開始時のいろと関係していて、同じ番号は同じ色から始まります。 終了するときは end_rainbow_b(対象の敵グループ内の番号) と記入すると同じ番号のバトラーの色が元に戻ります。 =end #============================================================================== # ■ Cache #============================================================================== module Cache #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def self.rainbow(filename = nil) if filename load_bitmap("Graphics/System/", filename) elsif include?("rainbow") @cache["rainbow"] else @cache["rainbow"] = Bitmap.new(120, 1) a = 160 color_set = [Color.new(255,0,0,a),Color.new(255,255,0,a),Color.new(0,0,255,a)] w = @cache["rainbow"].width / color_set.size color_set.size.times do |i| c1 = color_set[i] c2 = color_set[(i + 1) % color_set.size] @cache["rainbow"].gradient_fill_rect(w * i, 0, w, 1, c1, c2) end @cache["rainbow"] end end end #============================================================================== # ■ Sprite_Base #============================================================================== class Sprite #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias usk_rainbow_update update def update usk_rainbow_update update_rainbow end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def update_rainbow if self.rainbow_count > -1 self.rainbow_count %= rainbow_sample.width self.color = rainbow_sample.get_pixel(self.rainbow_count, 0) self.rainbow_count += 1 elsif self.rainbow_count == -1 reset_rainbow end end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def reset_rainbow self.rainbow_count = -2 self.color = Color.new(0, 0, 0, 0) end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count @rainbow_count ||= -2 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_sample Cache.rainbow(rainbow_file) end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count=(count) @rainbow_count = count end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_file @rainbow_file end end #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count @character.rainbow_count end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count=(count) @character.rainbow_count = count end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_file @character.rainbow_file end end #============================================================================== # ■ Sprite_Picture #============================================================================== class Sprite_Picture < Sprite #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count @picture.rainbow_count end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count=(count) @picture.rainbow_count = count end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_file @picture.rainbow_file end end #============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count @battler ? @battler.rainbow_count : -2 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_count=(count) @battler.rainbow_count = count if @battler end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rainbow_file @battler.rainbow_file if @battler end end #============================================================================== # ■ Game_CharacterBase #============================================================================== class Game_CharacterBase attr_accessor :rainbow_count attr_reader :rainbow_file #-------------------------------------------------------------------------- # ● 公開メンバ変数の初期化 #-------------------------------------------------------------------------- alias usk_rainbow_init_public_members init_public_members def init_public_members usk_rainbow_init_public_members @rainbow_count = -2 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def start_rainbow(seed = 0, file = nil) @rainbow_count = seed @rainbow_file = file end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def end_rainbow @rainbow_count = -1 end end #============================================================================== # ■ Game_Picture #============================================================================== class Game_Picture attr_accessor :rainbow_count attr_reader :rainbow_file #-------------------------------------------------------------------------- # ● 公開メンバ変数の初期化 #-------------------------------------------------------------------------- alias usk_rainbow_init_basic init_basic def init_basic usk_rainbow_init_basic @rainbow_count = -2 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def start_rainbow(seed = 0, file = nil) @rainbow_count = seed @rainbow_file = file end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def end_rainbow @rainbow_count = -1 end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler attr_accessor :rainbow_count attr_reader :rainbow_file #-------------------------------------------------------------------------- # ● 公開メンバ変数の初期化 #-------------------------------------------------------------------------- alias usk_rainbow_initialize initialize def initialize usk_rainbow_initialize @rainbow_count = -2 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def start_rainbow(seed = 0, file = nil) @rainbow_count = seed @rainbow_file = file end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def end_rainbow @rainbow_count = -1 end end #============================================================================== # ■ #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def start_rainbow(id, seed = 0, file = nil) return if screen.pictures[id].nil? screen.pictures[id].start_rainbow(seed, file) end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def end_rainbow(id) return if screen.pictures[id].nil? screen.pictures[id].end_rainbow end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def start_rainbow_b(id, seed = 0, file = nil) return if $game_troop.members[id].nil? $game_troop.members[id].start_rainbow(seed, file) end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def end_rainbow_b(id) return if $game_troop.members[id].nil? $game_troop.members[id].end_rainbow end end