| 
 
| 赞 | 3 |  
| VIP | 0 |  
| 好人卡 | 24 |  
| 积分 | 0 |  
| 经验 | 15951 |  
| 最后登录 | 2016-1-17 |  
| 在线时间 | 276 小时 |  
 Lv1.梦旅人 
	梦石0 星屑49 在线时间276 小时注册时间2011-6-5帖子133 | 
| 数据库敌人是只有hp上限而没有实际的hp的,只有真实的敌人才有hp,数据库那是敌人的“图纸” 要用 $game_troop.alive_members[index].hp
 自己写的在选择敌人窗口显示敌人血蓝你可以参考下,血条蓝条颜色选不太来。复制代码#encoding:utf-8
#==============================================================================
# ■ Window_BattleEnemy
#------------------------------------------------------------------------------
#  战斗画面中,选择“敌人目标”的窗口。
#==============================================================================
class Window_BattleEnemy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #     info_viewport : 信息显示用显示端口
  #--------------------------------------------------------------------------
  def initialize(info_viewport)
    super(0, info_viewport.rect.y, window_width, fitting_height(5))
    refresh
    self.visible = false
    @info_viewport = info_viewport
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width - 128
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # ● 获取项目数
  #--------------------------------------------------------------------------
  def item_max
    $game_troop.alive_members.size
  end
  #--------------------------------------------------------------------------
  # ● 获取敌人实例
  #--------------------------------------------------------------------------
  def enemy
    $game_troop.alive_members[@index]
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    change_color(normal_color)
    name = $game_troop.alive_members[index].name
    draw_text(item_rect_for_text(index), name)
    draw_enemy_icons(
    $game_troop.alive_members[index],
    item_rect(index).width - 350,item_rect(index).y)
    
    draw_gauge(
    item_rect(index).width - 250,
    item_rect(index).y-8, 
    140, 
    $game_troop.alive_members[index].hp_rate,
    Color.new(255,0,0), Color.new(0,255,0))
    
    draw_gauge(
    item_rect(index).width - 100,
    item_rect(index).y-8, 
    80, 
    $game_troop.alive_members[index].mp_rate,
    Color.new(1,1,205), Color.new(0,33,255))
    
    draw_current_and_max_values(
    item_rect(index).width - 250,
    item_rect(index).y,140,
    $game_troop.alive_members[index].hp,
    $game_troop.alive_members[index].mhp,
    hp_color($game_troop.alive_members[index]),
    normal_color
    )
    
    
    
  end
  def draw_enemy_icons(enemy, x, y, width = 96)
    icons = (enemy.state_icons + enemy.buff_icons)[0, width / 24]
    icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
  end
  def draw_current_and_max_values(x, y, width, current, max, color1, color2)
    change_color(color1)
    xr = x + width
    draw_text(xr - 132, y, 62, line_height, current, 2)
    change_color(color2)
    draw_text(xr - 72, y, 12, line_height, "/", 2)
    draw_text(xr - 62, y, 62, line_height, max, 2)
  end
  #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    if @info_viewport
      width_remain = Graphics.width - width
      self.x = width_remain
      @info_viewport.rect.width = width_remain
      select(0)
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @info_viewport.rect.width = Graphics.width if @info_viewport
    super
  end
end
 | 
 评分
查看全部评分
 |