#============================================================================== # ■ XP-RGSS-45 アローカーソル拡張 [Ver.1.0.1] by Claimh #------------------------------------------------------------------------------ # バトラーの位置に基づいたアローカーソルの切り替えをします。 #------------------------------------------------------------------------------ #【再定義】 # Arrow_Actor : update # Arrow_Enemy : update #============================================================================== #============================================================================== # ■ Arrow_Actor #============================================================================== class Arrow_Actor < Arrow_Base #-------------------------------------------------------------------------- # ● フレーム更新(再定義) #-------------------------------------------------------------------------- def update super # カーソル右 if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) cursor_right end # カーソル左 if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) cursor_left end # カーソル上 if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) cursor_up end # カーソル下 if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) cursor_down end # スプライトの座標を設定 if self.actor != nil self.x = self.actor.screen_x self.y = self.actor.screen_y + 50 end end #-------------------------------------------------------------------------- # ● カーソル更新前処理(左右) #-------------------------------------------------------------------------- def cursor_lr actors = [] for act in $game_party.actors actors.push(act) end # 並び替え actors.sort! {|a,b| b.screen_x - a.screen_x } return actors end #-------------------------------------------------------------------------- # ● カーソル更新処理(右) #-------------------------------------------------------------------------- def cursor_right actors = cursor_lr i = actors.index(self.actor) if i == 0 @index = actors[actors.size - 1].index else @index = actors[i - 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新処理(左) #-------------------------------------------------------------------------- def cursor_left actors = cursor_lr i = actors.index(self.actor) if i == (actors.size - 1) @index = actors[0].index else @index = actors[i + 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新前処理(上下) #-------------------------------------------------------------------------- def cursor_ud actors = [] for act in $game_party.actors actors.push(act) end # 並び替え actors.sort! {|a,b| b.screen_y - a.screen_y } return actors end #-------------------------------------------------------------------------- # ● カーソル更新処理(上) #-------------------------------------------------------------------------- def cursor_up actors = cursor_ud i = actors.index(self.actor) if i == (actors.size - 1) @index = actors[0].index else @index = actors[i + 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新処理(下) #-------------------------------------------------------------------------- def cursor_down actors = cursor_ud i = actors.index(self.actor) if i == 0 @index = actors[actors.size - 1].index else @index = actors[i - 1].index end end end #============================================================================== # ■ Arrow_Enemy #============================================================================== class Arrow_Enemy < Arrow_Base #-------------------------------------------------------------------------- # ● フレーム更新(再定義) #-------------------------------------------------------------------------- def update super # 存在しないエネミーを指していたら飛ばす $game_troop.enemies.size.times do break if self.enemy.exist? @index += 1 @index %= $game_troop.enemies.size end # カーソル右 if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) cursor_right end # カーソル左 if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) cursor_left end # カーソル上 if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) cursor_up end # カーソル下 if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) cursor_down end # スプライトの座標を設定 if self.enemy != nil self.x = self.enemy.screen_x self.y = self.enemy.screen_y end end #-------------------------------------------------------------------------- # ● カーソル更新前処理(左右) #-------------------------------------------------------------------------- def cursor_lr enemies = [] for e in $game_troop.enemies if e.exist? enemies.push(e) end end # 並び替え enemies.sort! {|a,b| b.screen_x - a.screen_x } return enemies end #-------------------------------------------------------------------------- # ● カーソル更新処理(右) #-------------------------------------------------------------------------- def cursor_right enemies = cursor_lr i = enemies.index(self.enemy) if i == 0 @index = enemies[enemies.size - 1].index else @index = enemies[i - 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新処理(左) #-------------------------------------------------------------------------- def cursor_left enemies = cursor_lr i = enemies.index(self.enemy) if i == (enemies.size - 1) @index = enemies[0].index else @index = enemies[i + 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新前処理(上下) #-------------------------------------------------------------------------- def cursor_ud enemies = [] for e in $game_troop.enemies if e.exist? enemies.push(e) end end # 並び替え enemies.sort! {|a,b| b.screen_y - a.screen_y } return enemies end #-------------------------------------------------------------------------- # ● カーソル更新処理(上) #-------------------------------------------------------------------------- def cursor_up enemies = cursor_ud i = enemies.index(self.enemy) if i == (enemies.size - 1) @index = enemies[0].index else @index = enemies[i + 1].index end end #-------------------------------------------------------------------------- # ● カーソル更新処理(下) #-------------------------------------------------------------------------- def cursor_down enemies = cursor_ud i = enemies.index(self.enemy) if i == 0 @index = enemies[enemies.size - 1].index else @index = enemies[i - 1].index end end end