#============================================================================== # ■ RGSS3 大型アニメーション Ver1.00a by 星潟 #------------------------------------------------------------------------------ # 一枚の大きな画像でアニメーションが完成している # 大型アニメーション素材による演出を可能とします。 #============================================================================== # アニメーションの名前欄に含ませる #------------------------------------------------------------------------------ # # # このアニメーションは元々設定されているセル設定が失われ # 大型アニメーションタイプ0が実行されます。 # タイミングの設定はそのまま使用されます。 #------------------------------------------------------------------------------ # # # このアニメーションは元々設定されているセル設定が失われ # 大型アニメーションタイプ1が実行されます。 # タイミングの設定はそのまま使用されます。 #============================================================================== # 大型アニメーション用の素材は通常のアニメーション素材と同じく # GraphicsフォルダのAnimationsフォルダに格納して下さい。 #------------------------------------------------------------------------------ # なお、大型アニメーションは各フレーム1セル目として実行され # 表示Z座標もそれに準じます。 #============================================================================== module BigAnimation #空のハッシュを用意。 S = {} #設定用キーワードを指定。 Word = "BIG" #以下に値に応じた設定を指定 #必要に応じて増やしたり減らしたり変更して下さい。 S[0] = { #対応ファイル名を指定 :name => "pipo-btleffect141", #色相を指定(0〜359) :hue => 0, #合成方法を指定(0:通常 1:加算 2:減算) :blend_type => 1, #フレーム数を指定 :frame_size => 30, #対応ファイルは横に何セル分並べられているか :xn => 3, #1セルの横幅を指定 :xs => 640, #1セルの縦幅を指定 :ys => 480, #表示位置固定の場合の基準X座標を指定。nilやfalseを指定すると固定しない :px => nil, #表示位置固定の場合の基準Y座標を指定。nilやfalseを指定すると固定しない :py => nil, #アニメーション前にセルなしのフレームをいくつ発生させるかを指定 :pf => 0, #アニメーション後にセルなしのフレームをいくつ発生させるかを指定 :af => 0 } S[1] = { #対応ファイル名を指定 :name => "pipo-btleffect165_640", #色相を指定(0〜359) :hue => 180, #合成方法を指定(0:通常 1:加算 2:減算) :blend_type => 2, #フレーム数を指定 :frame_size => 25, #対応ファイルは横に何セル分並べられているか :xn => 5, #1セルの横幅を指定 :xs => 640, #1セルの縦幅を指定 :ys => 480, #表示位置固定の場合の基準X座標を指定。nilやfalseを指定すると固定しない :px => Graphics.width / 2, #表示位置固定の場合の基準Y座標を指定。nilやfalseを指定すると固定しない :py => Graphics.height / 2, #アニメーション前にセルなしのフレームをいくつ発生させるかを指定 :pf => 0, #アニメーション後にセルなしのフレームをいくつ発生させるかを指定 :af => 0 } #Graphics.widthというのは画面の横幅を指します。 #Graphics.width / 2というのは画面の横幅の半分を指します。 #Graphics.heightというのは画面の縦幅を指します。 #Graphics.height / 2というのは画面の縦幅の半分を指します。 end class Sprite_Base < Sprite #-------------------------------------------------------------------------- # アニメーションスプライトの設定 #-------------------------------------------------------------------------- alias animation_set_sprites_big_animation animation_set_sprites def animation_set_sprites(frame) setting = frame.big_animation animation_set_sprites_big_animation(frame) if setting @ani_sprites.each_with_index do |sprite, i| next unless sprite if i == 0 && !setting.empty? xs = setting[:xs] ys = setting[:ys] sprite.bitmap = Cache.animation(setting[:name],setting[:hue]) sprite.src_rect.set(setting[:x],setting[:y],xs,ys) sprite.visible = true sprite.x = setting[:px] ? setting[:px] : @ani_ox sprite.y = setting[:py] ? setting[:py] : @ani_oy sprite.angle = 0 sprite.mirror = false sprite.ox = xs / 2 sprite.oy = ys / 2 sprite.zoom_x = 1.0 sprite.zoom_y = 1.0 sprite.opacity = 255.0 sprite.blend_type = setting[:blend_type] else sprite.visible = false end end end end end class RPG::Animation::Frame attr_accessor :big_animation end class RPG::Animation #-------------------------------------------------------------------------- # アニメーションスプライトの設定 #-------------------------------------------------------------------------- def big_animation_check unless @big_animation_check @big_animation_check = true if /<#{BigAnimation::Word}[::](\S+)>/ =~ name s = BigAnimation::S[$1.to_i] if s @frames = [] base_frame = RPG::Animation::Frame.new base_frame.cell_max = 1 base_frame.cell_data = Table.new(1, 8) temp_frame_max = s[:pf] + s[:frame_size] @frame_max = temp_frame_max + s[:af] @frame_max.times {|i| f = base_frame.clone f.cell_data[0,0] = 1 i2 = i - s[:pf] f.big_animation = (i < s[:pf] or i > temp_frame_max) ? {} : { :name => s[:name], :hue => s[:hue], :xs => s[:xs], :ys => s[:ys], :x => s[:xs] * (i2 % s[:xn]), :y => s[:ys] * (i2 / s[:xn]), :px => s[:px], :py => s[:py], :blend_type => s[:blend_type]} @frames.push(f)} end end end end #-------------------------------------------------------------------------- # フレーム数を取得 #-------------------------------------------------------------------------- unless method_defined?(:frame_max_big_animation) alias frame_max_big_animation frame_max def frame_max big_animation_check frame_max_big_animation end end #-------------------------------------------------------------------------- # フレームを取得 #-------------------------------------------------------------------------- unless method_defined?(:frames_big_animation) alias frames_big_animation frames def frames big_animation_check frames_big_animation end end end