Project1

标题: VA 如何在菜单里显示经验条 [打印本页]

作者: 133289280251    时间: 2012-11-16 19:51
标题: VA 如何在菜单里显示经验条
VA 如何在菜单里显示经验条
作者: tottoyea    时间: 2012-11-16 19:54
RUBY 代码复制
  1. #  ●設定區域
  2. #===================================
  3.  
  4. module WD
  5. module Exp_Gauge
  6.   #EXP條COLOR,請修改成TEXT文字
  7.   EXP_GAUGE_COLOR1 = 6
  8.   EXP_GAUGE_COLOR2 = 14
  9.  
  10.   #EXP條文字顯示設定,true為打開,false為關閉
  11.   EXP_TEXT_DISPLAY = false
  12. end
  13. end
  14.  
  15. #==============================================================================
  16. # ■ Window_Base
  17. #------------------------------------------------------------------------------
  18. #  ゲーム中の全てのウィンドウのスーパークラスです。
  19. #==============================================================================
  20.  
  21. class Window_Base < Window
  22.   include WD::Exp_Gauge
  23.  
  24.   def exp_gauge_color1;   text_color(EXP_GAUGE_COLOR1);  end;    # EXP ゲージ 1
  25.   def exp_gauge_color2;   text_color(EXP_GAUGE_COLOR2);  end;    # EXP ゲージ 2
  26.  
  27.   #--------------------------------------------------------------------------
  28.   # ● シンプルなステータスの描画
  29.   #--------------------------------------------------------------------------
  30.   def draw_actor_simple_status(actor, x, y)
  31.     draw_actor_name(actor, x, y + line_height * 0.5)
  32.     draw_actor_level(actor, x, y - line_height * 0.5)
  33.     draw_actor_icons(actor, x, y + line_height * 1.5)
  34.     draw_actor_class(actor, x + 120, y - line_height * 0.5)
  35.     draw_actor_hp(actor, x + 120, y + line_height * 0.5)
  36.     draw_actor_mp(actor, x + 120, y + line_height * 1.5)
  37.     draw_actor_exp(actor, x, y + line_height * 2.5, EXP_TEXT_DISPLAY)
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● EXP の描画
  41.   #--------------------------------------------------------------------------
  42.   def draw_actor_exp(actor, x, y, display = true, width = 244)
  43.     this_level = actor.exp - actor.past_level_exp
  44.     next_level = actor.next_level_exp - actor.past_level_exp
  45.     draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2)
  46.     change_color(system_color)
  47.     if display
  48.       draw_text(x, y, 30, line_height, "EXP")
  49.       draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)
  50.     end
  51.   end
  52. end
  53.  
  54. class Game_Actor < Game_Battler
  55.   #--------------------------------------------------------------------------
  56.   # ● EXP の割合を取得
  57.   #--------------------------------------------------------------------------
  58.   def exp_rate
  59.     this_level = exp - past_level_exp
  60.     next_level = next_level_exp - past_level_exp
  61.     next_level > 0 ? this_level.to_f / next_level : 0
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 前のレベルの経験値を取得
  65.   #--------------------------------------------------------------------------
  66.   def past_level_exp
  67.     @level > 1 ? exp_for_level(@level - 1) : 0
  68.   end
  69. end





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