| 
 
| 赞 | 7 |  
| VIP | 20 |  
| 好人卡 | 0 |  
| 积分 | 17 |  
| 经验 | 11472 |  
| 最后登录 | 2025-6-6 |  
| 在线时间 | 528 小时 |  
 Lv3.寻梦者 宛若 
	梦石0 星屑1663 在线时间528 小时注册时间2007-8-19帖子1493  
 | 
| ★Scene_Battle 1 25行下添加复制代码class Window_BattleEnemy < Window_Base
  def initialize(enemy = nil)
    @enemy = $game_troop.enemies[0]
    @hp_memory = @enemy.hp
    super(0,64,160,120)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 160
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_battler(@enemy, 0, 0) if @enemy != nil
    carol3_draw_hp_bar(@enemy , 160 - 32 - 128 , 0) if @enemy != nil
  end
  def enemy=(e)
    @enemy = e
    refresh
  end
  def update
    if @hp_memory != @enemy.hp
      @hp_memory = @enemy.hp
      refresh
    end
  end
  def draw_actor_battler(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x, y, bitmap, src_rect)
  end
  def carol3_draw_hp_bar(actor, x, y, width = 128) #宽度可调
   self.contents.font.color = system_color
   w = width * actor.hp / [actor.maxhp,1].max
   if actor.maxhp != 0
     rate = actor.hp.to_f / actor.maxhp
   else
     rate = 0
   end
   color1 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 150)
   self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+1, y+17, w,6,color1)
   self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
   self.contents.draw_text(x-53,y,128,32,$data_system.words.hp,1)
   if actor.hp>actor.maxhp/3
     self.contents.font.color = Color.new(255, 255, 255, 250)
   end
   if actor.hp>=actor.maxhp/6 and actor.maxhp/3>actor.hp
     self.contents.font.color = Color.new(200, 200, 0, 255)
   end
   if actor.maxhp/6>actor.hp
     self.contents.font.color = Color.new(200, 0, 0, 255)
   end
   self.contents.draw_text(x+47,y,128,32,actor.hp.to_s,1)
  end
  def carol3_draw_sp_bar(actor, x, y, width = 128)
   self.contents.font.color = system_color
   if actor.maxsp != 0
     rate = actor.sp.to_f / actor.maxsp
   else
     rate = 0
   end
   color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
   w = width * actor.sp / [actor.maxsp,1].max
   self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+1, y+17, w,6,color2)
   self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
   self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
   self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
   self.contents.draw_text(x-53,y,128,32,$data_system.words.sp,1)
   if actor.hp>actor.maxsp/3
     self.contents.font.color = Color.new(255, 255, 255, 250)
   end
   if actor.hp>=actor.maxsp/6 and actor.maxsp/3>actor.sp
     self.contents.font.color = Color.new(200, 200, 0, 255)
   end
   if actor.maxsp/6>actor.sp
     self.contents.font.color = Color.new(200, 0, 0, 255)
   end
   self.contents.draw_text(x+47,y,128,32,actor.sp.to_s,1)
  end
end
class Scene_Battle
  alias update_bz update
  def update
    @be_window.update
    update_bz
  end
end
@be_window = Window_BattleEnemy.new
 82行下添加
 @be_window.dispose
 
 大小&位置在脚本第五行调整
 四个参数分别为x,y,宽度,高度
 | 
 评分
查看全部评分
 |