Project1

标题: [已經解決]寫了顯示總戰力的腳本,但沒有畫出文字 [打印本页]

作者: b200077    时间: 2017-3-22 10:05
标题: [已經解決]寫了顯示總戰力的腳本,但沒有畫出文字
本帖最后由 b200077 于 2017-3-22 14:17 编辑
總戰力腳本


這裡總戰力指的是全部裝備欄能力加總
作者: 魔法丶小肉包    时间: 2017-3-22 11:27
本帖最后由 魔法丶小肉包 于 2017-3-22 11:33 编辑

稍作修改,楼主可以参考一下
RUBY 代码复制
  1. class Window_EquipStatus < Window_Base
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化对象
  4.   #--------------------------------------------------------------------------
  5.   def initialize(x, y)
  6.     super(x, y, window_width, window_height)
  7.     @actor = nil
  8.     @temp_actor = nil
  9.     @hurt = 0
  10.     refresh
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 刷新
  14.   #--------------------------------------------------------------------------
  15.   def refresh
  16.     contents.clear
  17.     draw_actor_name(@actor, 4, 0) if @actor
  18.     6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
  19.     draw_current_param2(0,0) if @actor
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 绘制總戰力
  23.   #--------------------------------------------------------------------------
  24.   def draw_current_param2(x, y)
  25.        @hurt = 0
  26.     6.times{|n| @hurt + @actor.param(2 + n) }
  27.     change_color(system_color)
  28.     draw_text(x-25, y, self.width, line_height, @hurt.to_s, 2)
  29.   end  
  30. end


还有,应该是6.times{|n| @hurt += @actor.param(2 + n) }
6.times{|n| @hurt + @actor.param(2 + n) }的话@hurt永远是0




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