#============================================================================== # ★ アニメーション拡張 ver1.0 by USK #------------------------------------------------------------------------------ # ・特定の名前のSEをダミーとして用い、アニメーションに合わせて対象グラフィック #  を拡大縮小、移動、回転、反転します。 #============================================================================== =begin SEフォルダに後述の名前のoggファイル(実体はなんでもいい)を用意し、アニメーション のSEの設定で、使用する効果のSEを、適用するフレームで鳴らすようにします。そうする と、SEが鳴る代わりにグラフィック効果が得られます。 名前と効果一覧 ZoomX(倍率).ogg => (倍率)の部分に記入した倍率でx方向に拡大縮小します。 例 ZoomX(1.5).ogg ZoomY(倍率).ogg => (倍率)の部分に記入した倍率でy方向に拡大縮小します。 例 ZoomY(0.8).ogg MoveX(ピクセル数).ogg => (ピクセル数)の部分に記入しただけx方向に移動します。 例 MoveX(-20).ogg MoveY(ピクセル数).ogg => (ピクセル数)の部分に記入しただけy方向に移動します。 例 MoveY(20).ogg Mirror.ogg => 反転します。 Rotate(角度).ogg => (角度)の部分に記入しただけ反時計回りに回転します。 例 Rotate(-45).ogg Common(ID).ogg => スキル・アイテムのアニメーションの場合(ID)の部分に記入した コモンイベントを起動します。 Reset.ogg => 拡大縮小、移動、反転の効果をリセットします。 =end #============================================================================== # ■ Sprite_Base #============================================================================== class Sprite_Base < Sprite ExSign = { "ZoomX" =>"self.zoom_x=", "ZoomY" =>"self.zoom_y=", "MoveX" =>"self.x+=", "MoveY" =>"self.y+=", "Mirror"=>"self.mirror=!mirror", "Rotate"=>"rotate ", "Common"=>"common_event ", "Reset" =>"reset_ex_param" } #-------------------------------------------------------------------------- # ● SE とフラッシュのタイミング処理 #-------------------------------------------------------------------------- alias usk_ex_animation_process_timing animation_process_timing def animation_process_timing(timing) if timing.se.name =~ /(#{ex_sign})\s*\(?([-\d\.]*)\)?/ eval(ExSign[$1] + $2) rescue p ExSign[$1] + $2 else usk_ex_animation_process_timing(timing) end end #-------------------------------------------------------------------------- # ● アニメーションの開始 #-------------------------------------------------------------------------- alias usk_ex_start_animation start_animation def start_animation(animation, mirror = false) usk_ex_start_animation(animation, mirror) save_ex_param end #-------------------------------------------------------------------------- # ● アニメーションの終了 #-------------------------------------------------------------------------- alias usk_ex_end_animation end_animation def end_animation usk_ex_end_animation reset_ex_param end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def rotate(angle) dx = ox - (width >> 1) dy = oy - (height >> 1) self.x -= dx self.y -= dy self._ox = width >> 1 self._oy = height >> 1 self.angle = angle end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def _ox=(val) @usk_flag = true self.ox = val @usk_flag = false end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def _oy=(val) @usk_flag = true self.oy = val @usk_flag = false end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def ox=(val) super(val) if !animation? || @usk_flag end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def oy=(val) super(val) if !animation? || @usk_flag end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def common_event(id) if SceneManager.scene_is?(Scene_Battle) && !$game_troop.interpreter.running? $game_troop.interpreter.setup($data_common_events[id].list) $game_troop.interpreter.update end end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def save_ex_param @ex_param = {"x=" => x, :"y=" => y, :"zoom_x=" => zoom_x, "ox=" => ox, "oy=" => oy, "zoom_y=" => zoom_y, "angle=" => angle, "mirror=" => mirror} end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def reset_ex_param(dummy = nil) @ex_param.each do |key, val| send(key, val) end if @ex_param end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def ex_sign @@usk_ex_sign ||= get_ex_sign end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def get_ex_sign ret = "" ExSign.each_key{|v| ret += v + "|"} ret.chop end end #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ● 位置の更新 #-------------------------------------------------------------------------- alias usk_ex_update_position update_position def update_position usk_ex_update_position unless animation? end end #============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ● 位置の更新 #-------------------------------------------------------------------------- alias usk_ex_update_position update_position def update_position usk_ex_update_position unless animation? end end