#============================================================================== # [ZTBS] -Zenith Tactical Battle System- タクティカルバトルシステム #  〜+B19:色々とアニメーション〜   by 水夜 #  ver0.90  Zenith Creation (http://zenith.ifdef.jp/) #------------------------------------------------------------------------------ # マップ上での戦略的なバトルを実現。 #============================================================================== #============================================================================== # □ カスタマイズポイント #============================================================================== module ZTBSB19 # アニメーションフレーム ANIMATION_FRAME = 4 end #============================================================================== # ■ Sprite_Cursor #============================================================================== class Sprite_Cursor < RPG::Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # viewport : ビューポート # character : キャラクター (Game_Character) #-------------------------------------------------------------------------- def initialize(viewport, x, y) super(viewport) self.bitmap = RPG::Cache.picture(ZTBS::CURSOR) self.src_rect.x = 0 self.src_rect.y = 0 self.src_rect.width = self.bitmap.height self.ox = self.bitmap.height / 2 self.oy = self.bitmap.height @anime_count = 0 @cell_max = self.bitmap.width / self.bitmap.height moveto(x, y) if defined?(ZTBSB19) self.z = 999 @real_x = @map_x * 128 @real_y = @map_y * 128 end update end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # アニメーションもさせる self.src_rect.x = self.bitmap.height * ((@anime_count / ZTBSB19::ANIMATION_FRAME) % @cell_max) @anime_count += 1 if defined?(ZTBSB8) unless moving? moveto($game_player.x, $game_player.y) end # スプライトの座標を設定 self.x = screen_x self.y = screen_y # 移動速度からマップ座標系での移動距離に変換 if Input.press?(ZTBSB8::DASH_KEY) distance = 2 ** ($game_player.move_speed + ZTBSB8::CURSOR_SPEEDUP) else distance = 2 ** $game_player.move_speed end # 論理座標が実座標より下の場合 if @map_y * 128 > @real_y # 下に移動 @real_y = [@real_y + distance, @map_y * 128].min end # 論理座標が実座標より左の場合 if @map_x * 128 < @real_x # 左に移動 @real_x = [@real_x - distance, @map_x * 128].max end # 論理座標が実座標より右の場合 if @map_x * 128 > @real_x # 右に移動 @real_x = [@real_x + distance, @map_x * 128].min end # 論理座標が実座標より上の場合 if @map_y * 128 < @real_y # 上に移動 @real_y = [@real_y - distance, @map_y * 128].max end # センタリング center(@real_x / 128.0, @real_y / 128.0) else moveto($game_player.x, $game_player.y) # スプライトの座標を設定 self.x = screen_x self.y = screen_y self.z = screen_z + 1 end end end #============================================================================== # ■ Sprite_Area #============================================================================== class Sprite_Area < RPG::Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # viewport : ビューポート # character : キャラクター (Game_Character) #-------------------------------------------------------------------------- def initialize(viewport, type, x, y, invisible = false) super(viewport) case type when 0 self.bitmap = RPG::Cache.picture(ZTBS::ACTOR_AREA) when 1 self.bitmap = RPG::Cache.picture(ZTBS::ENEMY_AREA) end @anime_count = 0 self.src_rect.width = self.bitmap.height self.ox = self.bitmap.height / 2 self.oy = self.bitmap.height @cell_max = self.bitmap.width / self.bitmap.height self.opacity = 0 if invisible self.opacity = 128 moveto(x, y) update end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # アニメーションもさせる self.src_rect.x = self.bitmap.height * ((@anime_count / ZTBSB19::ANIMATION_FRAME) % @cell_max) @anime_count += 1 # スプライトの座標を設定 self.x = screen_x self.y = screen_y self.z = screen_z end end #============================================================================== # ■ Sprite_Range #============================================================================== class Sprite_Range < RPG::Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # viewport : ビューポート # character : キャラクター (Game_Character) #-------------------------------------------------------------------------- def initialize(viewport, type, x, y, invisible = false) super(viewport) case type when 0 self.bitmap = RPG::Cache.picture(ZTBS::ACTOR_TARGET_AREA) when 1 self.bitmap = RPG::Cache.picture(ZTBS::ENEMY_TARGET_AREA) end @anime_count = 0 self.src_rect.width = self.bitmap.height self.ox = self.bitmap.height / 2 self.oy = self.bitmap.height @cell_max = self.bitmap.width / self.bitmap.height self.opacity = 0 if invisible self.opacity = 128 @plus_map_x = x - $game_player.x @plus_map_y = y - $game_player.y moveto(x, y) update end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # アニメーションもさせる self.src_rect.x = self.bitmap.height * ((@anime_count / ZTBSB8::ANIMATION_FRAME) % @cell_max) @anime_count += 1 @map_x = $game_player.x + @plus_map_x @map_y = $game_player.y + @plus_map_y @real_x = @map_x * 128 @real_y = @map_y * 128 # スプライトの座標を設定 self.x = screen_x self.y = screen_y self.z = screen_z end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # ● アクターフェーズ開始 #-------------------------------------------------------------------------- def start_phase1 # フェーズ 1 に移行 $game_system.tactics_phase = 1 # 行動済みフラグを解除 clear_acted # アクターフェーズ開始画像表示 appear_actor_phase_picture # ターンカウント $game_system.tactics_turn += 1 # ステップを 1 に設定 $game_system.tactics_step = 1 # カーソル固定を解除 $game_player.not_update = false # ターンイベントセット if defined? turn_event set_turn_event end end #-------------------------------------------------------------------------- # ● アクターフェーズ開始画像表示 #-------------------------------------------------------------------------- def appear_actor_phase_picture @help_window.visible = false @count = 0 @picture = RPG::Sprite.new @picture.animation($data_animations[ZTBS::ACTOR_PHASE], false) @picture.x = 320 @picture.y = 240 while @picture.effect? @picture.update # スプライトセットを更新 @spriteset.update # ゲーム画面を更新 Graphics.update end @picture.dispose_animation @picture.dispose @picture = nil end #-------------------------------------------------------------------------- # ● アクターフェーズ開始画像表示 #-------------------------------------------------------------------------- def appear_enemy_phase_picture @help_window.visible = false @count = 0 @picture = RPG::Sprite.new @picture.animation($data_animations[ZTBS::ENEMY_PHASE], false) @picture.x = 320 @picture.y = 240 while @picture.effect? @picture.update # スプライトセットを更新 @spriteset.update # ゲーム画面を更新 Graphics.update end @picture.dispose_animation @picture.dispose @picture = nil end end