Project1

标题: 关于战斗光标和行走图战斗的问题 [打印本页]

作者: RM无节操小分队    时间: 2014-11-23 12:07
标题: 关于战斗光标和行走图战斗的问题
RT,就是我用的是SideView  Ver100   横版战斗,然后使用了敌人行走图动态效果,
在使用了战斗光标脚本后,战斗光标的位置,在最上面,我不知道修改哪里,
才能让光标的箭头和名字框往下一些

javascript:;

下面是战斗光标脚本还有我游戏里面的截图

RUBY 代码复制下载
  1. #==============================================================================
  2. # ■ Window_BtArrowHelp
  3. #==============================================================================
  4. class Window_BtArrowHelp < Window_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● オブジェクト初期化
  7.   #--------------------------------------------------------------------------
  8.   def initialize
  9.     super(0, 0, Graphics.width, fitting_height(1))
  10.     self.openness = 0
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● バトラー設定
  14.   #--------------------------------------------------------------------------
  15.   def set_battler(battler, height)
  16.     if battler != @battler
  17.       [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  18.       w = contents.text_size(@battler.name).width
  19.       self.width = w + standard_padding * 2
  20.       create_contents
  21.       refresh
  22.       update_position(height)
  23.       self.openness = 0
  24.       open
  25.     end
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 表示位置
  29.   #--------------------------------------------------------------------------
  30.   def update_position(height)
  31.     if @battler.actor?#角色帮助窗口坐标
  32.       xx = [0, @battler.sv.x / 100 - self.width / 2 - 44].max #~~
  33.       yy = [0, @battler.sv.y / 100  - height - 60].max #~~
  34.     else#敌人帮助窗口坐标
  35.       xx = [0, @battler.screen_x - self.width / 2 -20].max #~~
  36.       yy = [0, @battler.screen_y - height - 60].max #~~
  37.     end
  38.     self.x = [xx, Graphics.width  - self.width ].min
  39.     self.y = [yy, Graphics.height - self.height].min
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● クリア
  43.   #--------------------------------------------------------------------------
  44.   def clear
  45.     contents.clear
  46.     @battler = nil
  47.     self
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● リフレッシュ(バトラーステータス)
  51.   #--------------------------------------------------------------------------
  52.   def refresh
  53.     contents.clear
  54.     draw_text(0, 0, contents.width, line_height, @battler.name, 1)
  55. #~     draw_battler_states
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● ステート描画
  59.   #--------------------------------------------------------------------------
  60.   def draw_battler_states
  61.     w = contents.text_size(@battler.name).width + 4
  62.     draw_actor_icons(@battler, w, 0)
  63.   end
  64. end




RUBY 代码复制下载
  1. #==============================================================================
  2. # ■ BtArrow_Base
  3. #==============================================================================
  4. class BtArrow_Base < Sprite
  5.   #--------------------------------------------------------------------------
  6.   # ● 公開インスタンス変数
  7.   #--------------------------------------------------------------------------
  8.   attr_accessor :active
  9.   attr_reader   :index
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   def initialize(viewport=nil)
  14.     @count = 0
  15.     @index = -1
  16.     @handler = {}
  17.     @cursor_fix = false
  18.     @cursor_all = false
  19.     super(viewport)
  20.     self.bitmap = Cache.system(arrow_file)
  21.     self.ox = arrow_width / 2
  22.     self.src_rect = Rect.new(0, 0, arrow_width, bitmap.height)
  23.     deactivate.hide
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 桁数の取得
  27.   #--------------------------------------------------------------------------
  28.   def col_max
  29.     return 1
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 項目数の取得
  33.   #--------------------------------------------------------------------------
  34.   def item_max
  35.     return 0
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● アロー画像分割数
  39.   #--------------------------------------------------------------------------
  40.   def arrow_col
  41.     return 4
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● アロー画像幅
  45.   #--------------------------------------------------------------------------
  46.   def arrow_width
  47.     bitmap.width / arrow_col
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● アロー画像
  51.   #--------------------------------------------------------------------------
  52.   def arrow_file
  53.     return "Arrow"
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● アローの表示
  57.   #--------------------------------------------------------------------------
  58.   def show
  59.     self.visible = true
  60.     self
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● アローの非表示
  64.   #--------------------------------------------------------------------------
  65.   def hide
  66.     self.visible = false
  67.     self
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● ウィンドウのアクティブ化
  71.   #--------------------------------------------------------------------------
  72.   def activate
  73.     self.active = true
  74.     self
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● ウィンドウの非アクティブ化
  78.   #--------------------------------------------------------------------------
  79.   def deactivate
  80.     self.active = false
  81.     self
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● フレーム更新
  85.   #--------------------------------------------------------------------------
  86.   def update
  87.     return unless self.visible
  88.     super
  89.     update_cursor
  90.     process_cursor_move
  91.     process_handling
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● フレーム更新 : アロー更新
  95.   #--------------------------------------------------------------------------
  96.   def update_cursor
  97.     @count = (@count + 1) % arrow_round
  98.     if (@count % arrow_mtn) == 0
  99.       x = (@count / arrow_mtn) * arrow_width
  100.       self.src_rect = Rect.new(x, 0, arrow_width, bitmap.height)
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● アローアニメーションの更新間隔
  105.   #--------------------------------------------------------------------------
  106.   def arrow_mtn
  107.     return 4
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● アローアニメーション
  111.   #--------------------------------------------------------------------------
  112.   def arrow_round
  113.     arrow_col * arrow_mtn
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● アクティブ状態の変更
  117.   #--------------------------------------------------------------------------
  118.   def active=(active)
  119.     @active = active
  120.     update_cursor
  121.     call_update_help
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● カーソル位置の設定
  125.   #--------------------------------------------------------------------------
  126.   def index=(index)
  127.     @index = index
  128.     update_cursor
  129.     call_update_help
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 項目の選択
  133.   #--------------------------------------------------------------------------
  134.   def select(index)
  135.     self.index = index if index
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 項目の選択解除
  139.   #--------------------------------------------------------------------------
  140.   def unselect
  141.     self.index = -1
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● ヘルプウィンドウの設定
  145.   #--------------------------------------------------------------------------
  146.   def help_window=(help_window)
  147.     @help_window = help_window
  148.     call_update_help
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● ヘルプウィンドウ更新メソッドの呼び出し
  152.   #--------------------------------------------------------------------------
  153.   def call_update_help
  154.     update_help if active && @help_window
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● ヘルプウィンドウの更新
  158.   #--------------------------------------------------------------------------
  159.   def update_help
  160.     @help_window.clear
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 選択項目の有効状態を取得
  164.   #--------------------------------------------------------------------------
  165.   def current_item_enabled?
  166.     return true
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 動作に対応するハンドラの設定
  170.   #     method : ハンドラとして設定するメソッド (Method オブジェクト)
  171.   #--------------------------------------------------------------------------
  172.   def set_handler(symbol, method)
  173.     @handler[symbol] = method
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● ハンドラの存在確認
  177.   #--------------------------------------------------------------------------
  178.   def handle?(symbol)
  179.     @handler.include?(symbol)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● ハンドラの呼び出し
  183.   #--------------------------------------------------------------------------
  184.   def call_handler(symbol)
  185.     @handler[symbol].call if handle?(symbol)
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● カーソルを下に移動
  189.   #--------------------------------------------------------------------------
  190.   def cursor_down(wrap = false)
  191.     if index < item_max - col_max || (wrap && col_max == 1)
  192.       select((index + col_max) % item_max)
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● カーソルを上に移動
  197.   #--------------------------------------------------------------------------
  198.   def cursor_up(wrap = false)
  199.     if index >= col_max || (wrap && col_max == 1)
  200.       select((index - col_max + item_max) % item_max)
  201.     end
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● カーソルを右に移動
  205.   #--------------------------------------------------------------------------
  206.   def cursor_right(wrap = false)
  207.     if col_max >= 2 && (index < item_max - 1 || wrap)
  208.       select((index + 1) % item_max)
  209.     end
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● カーソルを左に移動
  213.   #--------------------------------------------------------------------------
  214.   def cursor_left(wrap = false)
  215.     if col_max >= 2 && (index > 0 || wrap)
  216.       select((index - 1 + item_max) % item_max)
  217.     end
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● カーソルの移動処理
  221.   #--------------------------------------------------------------------------
  222.   def process_cursor_move
  223.     last_index = @index
  224.     cursor_right (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  225.     cursor_left   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  226.     cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  227.     cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  228.     Sound.play_cursor if @index != last_index
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 決定やキャンセルなどのハンドリング処理
  232.   #--------------------------------------------------------------------------
  233.   def process_handling
  234.     return unless active
  235.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  236.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  237.     return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
  238.     return process_pageup   if handle?(:pageup)   && Input.trigger?(:L)
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 決定処理の有効状態を取得
  242.   #--------------------------------------------------------------------------
  243.   def ok_enabled?
  244.     handle?(:ok)
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● キャンセル処理の有効状態を取得
  248.   #--------------------------------------------------------------------------
  249.   def cancel_enabled?
  250.     handle?(:cancel)
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ● 決定ボタンが押されたときの処理
  254.   #--------------------------------------------------------------------------
  255.   def process_ok
  256.     if current_item_enabled?
  257.       Sound.play_ok
  258.       Input.update
  259.       deactivate
  260.       call_ok_handler
  261.     else
  262.       Sound.play_buzzer
  263.     end
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 決定ハンドラの呼び出し
  267.   #--------------------------------------------------------------------------
  268.   def call_ok_handler
  269.     call_handler(:ok)
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● キャンセルボタンが押されたときの処理
  273.   #--------------------------------------------------------------------------
  274.   def process_cancel
  275.     Sound.play_cancel
  276.     Input.update
  277.     deactivate
  278.     call_cancel_handler
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● キャンセルハンドラの呼び出し
  282.   #--------------------------------------------------------------------------
  283.   def call_cancel_handler
  284.     call_handler(:cancel)
  285.   end
  286. end
  287.  
  288.  
  289. #==============================================================================
  290. # ■ BtArrow_Actor
  291. #==============================================================================
  292. class BtArrow_Actor < BtArrow_Base
  293.   #--------------------------------------------------------------------------
  294.   # ● 桁数の取得
  295.   #--------------------------------------------------------------------------
  296.   def col_max
  297.     item_max
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 項目数の取得
  301.   #--------------------------------------------------------------------------
  302.   def item_max
  303.     $game_party.battle_members.size
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● アクターオブジェクト取得
  307.   #--------------------------------------------------------------------------
  308.   def actor
  309.     $game_party.battle_members[@index]
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● フレーム更新 : アロー更新
  313.   #--------------------------------------------------------------------------
  314.   def update_cursor
  315.     super
  316.       self.x = actor.sv.x / 100 - 44 #~~
  317.       self.y = actor.sv.y / 100 - actor.sv.ch #~~
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● ヘルプウィンドウの更新
  321.   #--------------------------------------------------------------------------
  322.   def update_help
  323.     @help_window.set_battler(actor,actor.sv.ch)
  324.   end
  325. end
  326.  
  327. #==============================================================================
  328. # ■ BtArrow_Enemy
  329. #==============================================================================
  330. class BtArrow_Enemy < BtArrow_Base
  331.   #--------------------------------------------------------------------------
  332.   # ● 桁数の取得
  333.   #--------------------------------------------------------------------------
  334.   def col_max
  335.     item_max
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 項目数の取得
  339.   #--------------------------------------------------------------------------
  340.   def item_max
  341.     $game_troop.alive_members.size
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● エネミーオブジェクト取得
  345.   #--------------------------------------------------------------------------
  346.   def enemy
  347.     $game_troop.alive_members[@index]
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● バトラーの高さ
  351.   #--------------------------------------------------------------------------
  352.   def battler
  353.     Cache.battler(enemy.battler_name, enemy.battler_hue)
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● フレーム更新 : アロー更新
  357.   #--------------------------------------------------------------------------
  358.   def update_cursor
  359.     super
  360.     self.x = enemy.screen_x - 20 #~~
  361.     self.y = enemy.screen_y - battler.height #~~
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● ヘルプウィンドウの更新
  365.   #--------------------------------------------------------------------------
  366.   def update_help
  367.     @help_window.set_battler(enemy, battler.height)
  368.   end
  369. end




RUBY 代码复制下载
  1. #==============================================================================
  2. # ■ Scene_Battle
  3. #==============================================================================
  4. class Scene_Battle < Scene_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● 更新全部窗口
  7.   #--------------------------------------------------------------------------
  8.   def update_all_windows
  9.     super
  10.     @actor_window.update
  11.     @enemy_window.update
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ● 生成帮助窗口
  15.   #--------------------------------------------------------------------------
  16.   def create_help_window
  17.     @help_window = Window_Help.new
  18.     @help_window.visible = false
  19.     @arrow_help_window = Window_BtArrowHelp.new
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 生成角色窗口
  23.   #--------------------------------------------------------------------------
  24.   def create_actor_window
  25.     @actor_window = BtArrow_Actor.new
  26.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  27.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  28.   end  
  29.   #--------------------------------------------------------------------------
  30.   # ● 生成敌人窗口
  31.   #--------------------------------------------------------------------------
  32.   def create_enemy_window
  33.     @enemy_window = BtArrow_Enemy.new
  34.     @enemy_window.set_handler(:ok,     method(:on_enemy_ok))
  35.     @enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 角色选择开始
  39.   #--------------------------------------------------------------------------
  40.   def select_actor_selection
  41.     @actor_window.index = 0
  42.     @actor_window.help_window = @arrow_help_window
  43.     @actor_window.show.activate   
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 角色“确定”
  47.   #--------------------------------------------------------------------------
  48.   alias on_actor_ok_origi on_actor_ok
  49.   def on_actor_ok   
  50.     @arrow_help_window.clear.close
  51.     on_actor_ok_origi
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 角色“取消”
  55.   #--------------------------------------------------------------------------
  56.   def on_actor_cancel
  57.     @actor_window.hide
  58.     @arrow_help_window.clear.close
  59.     case @actor_command_window.current_symbol
  60.     when :skill
  61.       @skill_window.show.activate
  62.     when :item
  63.       @item_window.show.activate
  64.     end
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 开始选择敌人
  68.   #--------------------------------------------------------------------------
  69.   def select_enemy_selection
  70.     @enemy_window.index = 0
  71.     @enemy_window.help_window = @arrow_help_window
  72.     @enemy_window.show.activate
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ●  敌人“确定”
  76.   #--------------------------------------------------------------------------
  77.   alias on_enemy_ok_origi on_enemy_ok
  78.   def on_enemy_ok
  79.     @arrow_help_window.clear.close
  80.     on_enemy_ok_origi
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 敌人“取消”
  84.   #--------------------------------------------------------------------------
  85.   def on_enemy_cancel
  86.     @enemy_window.hide
  87.     @arrow_help_window.clear.close
  88.     case @actor_command_window.current_symbol
  89.     when :attack
  90.       @actor_command_window.open.activate
  91.     when :skill
  92.       @skill_window.show.activate
  93.     when :item
  94.       @item_window.show.activate
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 技能“确定”
  99.   #--------------------------------------------------------------------------
  100.   alias on_skill_ok_origi on_skill_ok
  101.   def on_skill_ok
  102.     @skill_window.hide
  103.     on_skill_ok_origi
  104.   end
  105.  
  106.   #--------------------------------------------------------------------------
  107.   # ● 物品“确定”
  108.   #--------------------------------------------------------------------------
  109.   alias on_item_ok_origi on_item_ok
  110.   def on_item_ok
  111.     @item_window.hide
  112.     on_item_ok_origi
  113.   end
  114. end

QQ截图20141123120058.png (278.37 KB, 下载次数: 20)

QQ截图20141123120058.png

作者: 希忆    时间: 2014-11-23 17:47
修改的地方很好找呀,第一个脚本34行
  1. else#敌人帮助窗口坐标
  2.   xx = [0, @battler.screen_x - self.width / 2 -20].max #~~
  3.   yy = [0, @battler.screen_y - height - 60].max #~~
  4. end
复制代码
改yy = [0, @battler.screen_y - height + 10].max

具体自己微调,-10 +10 +20 调到你觉得不错的位置





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1